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

# change version in setup.cfg
$ ./setup.py sdist
$ twine upload dist/*

tests

# get into a virtual env of some kind
$ pip install -r requirements.txt
$ 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

./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.3.tar.gz (6.0 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: django-ckc-0.0.3.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for django-ckc-0.0.3.tar.gz
Algorithm Hash digest
SHA256 f822c04a830c1a83ef9e903e0d768c43f39086d7372804bdb922e6e249f1f110
MD5 d984433c5dd6b2767b42908545bd9bdb
BLAKE2b-256 d4f9b1cd34d67a249c48f0963b2e02c2b35258475901309f89b0b8cc73b5af0f

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