Skip to main content

tools, utilities, etc. we use across projects @ ckc

Project description

django-ckc CKC

tools, utilities , etc. we use across projects @ ckc

installing

pip install django-ckc
# settings.py
INSTALLED_APPS = (
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.staticfiles",

    # ... add ckc
    "ckc",
)

distributing and releasing

# Update version in setup.cfg
./setup.py sdist
twine upload dist/*
# Commit and push the version update in setup.cfg
# Publish vX.X.X release on GitHub with a description.

tests

$ docker build -t django-ckc . && docker run django-ckc pytest

what's in this

SoftDeletableModel

Make your models have a deleted bool set when they are deleted instead of actuallying being deleted. Uses a model manager SoftDeleteModelManager to keep them hidden.

DefaultUserCreateMixin for ModelSerializers

This will automatically set YourModel.created_by to request.user. To override which attribute the user is written to, add a user_field to your classes Meta information

class YourModel(models.Model):
    created_by = models.ForeignKey(User, on_delete=models.CASCADE)
        

class MySerializer(DefaultUserCreateMixin, ModelSerializer):
    class Meta:
        model = YourModel

DjangoGeoPointProvider

Helps generate geo points in Factory Boy factories.

# factories.py
class SomeLocationFactory(DjangoModelFactory):
    location = factory.Faker('geo_point', country_code='US')

    class Meta:
        model = SomeLocation

# test_whatever.py
from django.contrib.gis.geos import Point


class WhateverTest(TestCase):
    def test_something(self):
        SomeLocationFactory()  # random location
        SomeLocationFactory(location=Point(x=60, y=60))  # specified location

./manage.py commands

command description
upload_file <source> <destination> uses django-storages settings to upload a file

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-ckc-0.0.7.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

django_ckc-0.0.7-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file django-ckc-0.0.7.tar.gz.

File metadata

  • Download URL: django-ckc-0.0.7.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for django-ckc-0.0.7.tar.gz
Algorithm Hash digest
SHA256 958e9ba46e00dcdc0dfced137cf6d773434264f757245a6c19e2bde0fed26e31
MD5 00bb1ce250ddf7d7797a835657071b5c
BLAKE2b-256 fb569dc14855cf3a51740c8da2073d7ba95f73858b143433cf184f1c62b7c4af

See more details on using hashes here.

File details

Details for the file django_ckc-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: django_ckc-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for django_ckc-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 4abab35887a16bc8c84e84cfdd95d2e339c36596dfcd21d119bdeeafcb787eec
MD5 8fedc5ebeb129885e1fba09634ca905b
BLAKE2b-256 e3ef71fff4186a4a2f9e29bdad9353c1cec6a4a261ee042eaf7fd807eec2abc2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page