Skip to main content

Reusable Django app to safely use non-core optional model Meta options

Project description

djsommo

Django safe optional model Meta options.

Django doesn't support adding third-party fields to the model class Meta. It raises an exception if one is encountered.

Many installable apps inject a model Meta option name into Django during initialisation, after which it is safe to use them.

However what happens if the installable app isnt working for some reason, and you want to disable it.

Then you need to remove all use of the Meta option from the models.

This app provides a Meta class which detects unknown options, issues a warning and discards them before Django can raise an exception.

Usage

In models.py

from django.db import models

from djsommo import SafeOptionalMeta


class MyModel(models.Model):
    uuid = models.TextField()
    ...
    class Meta(SafeOptionalMeta):
        unknown_option = True

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

djsommo-0.1.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

djsommo-0.1.0-py2.py3-none-any.whl (2.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file djsommo-0.1.0.tar.gz.

File metadata

  • Download URL: djsommo-0.1.0.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

File hashes

Hashes for djsommo-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2e8241202757b7386d219de27c64d923517d83ab11a1433b75e5995b44278250
MD5 c38cf284c46394462cd07f8c65b6fc63
BLAKE2b-256 291e2d988c088ecf7ba76ffc859f1d83371febde3576052e9913c1fdc050b0aa

See more details on using hashes here.

File details

Details for the file djsommo-0.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: djsommo-0.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 2.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

File hashes

Hashes for djsommo-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6b2ef9d604c8518aebe34f414da068554d4a8c049ab9af9e87eab0c765d53326
MD5 79087321fe3b9158e0509575f1ce7ca0
BLAKE2b-256 ed60874893d1f131107daeb0c6a1a57bb44a541005b36734c33aaa3cee3c13fc

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