Skip to main content

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

Metadata

Release files for djsommo 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for djsommo 0.2.1
File Size Uploaded
djsommo-0.2.1.tar.gz 4.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for djsommo 0.2.1
File Interpreter ABI Platform
djsommo-0.2.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 7.8 kB

Release files / djsommo-0.2.1.tar.gz

Download URL djsommo-0.2.1.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ffb6cc99041f6798ff0a6d14118d055962f4c3378c96a814fe106d1f0e6d1122
BLAKE2b-256 checksum
How to use checksums
dcf4a91dd5be6f9e74cc406fe133dabc4dc413a82c7a3c169619c866dee42644
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / djsommo-0.2.1-py2.py3-none-any.whl

Download URL djsommo-0.2.1-py2.py3-none-any.whl
Size 3.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
ec88eb3190b9f94385bf86f9a149f73bd44f5d74d684003e52475b5573c980bc
BLAKE2b-256 checksum
How to use checksums
beee25b00237d496b62b0198c1608d08dfae1e8e5726112e3a1fd08d29571c72
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page