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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file djsommo-0.2.1.tar.gz
.
File metadata
- Download URL: djsommo-0.2.1.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | ffb6cc99041f6798ff0a6d14118d055962f4c3378c96a814fe106d1f0e6d1122 |
|
MD5 | b71ffe24f816b3b6d1c8b561e2904960 |
|
BLAKE2b-256 | dcf4a91dd5be6f9e74cc406fe133dabc4dc413a82c7a3c169619c866dee42644 |
File details
Details for the file djsommo-0.2.1-py2.py3-none-any.whl
.
File metadata
- Download URL: djsommo-0.2.1-py2.py3-none-any.whl
- Upload date:
- Size: 3.5 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec88eb3190b9f94385bf86f9a149f73bd44f5d74d684003e52475b5573c980bc |
|
MD5 | 816e1017d62233d6109d45f1d1c18fa8 |
|
BLAKE2b-256 | beee25b00237d496b62b0198c1608d08dfae1e8e5726112e3a1fd08d29571c72 |