django-model-field-meta
An easy-to-use plugin to allow optional metadata of model fields.
Compatible with django-model-utils, safedelete, etc.
Tested on Python 3+, Django 2.1+.
Example
Inserting metadata:
from django.db import models # Remove this
from model_field_meta import models, FieldMetaMixin
class MyModel(FieldMetaMixin, models.Model): # Add FieldMetaMixin
my_field = models.TextField(meta={"key": "value"})
Accessing metadata:
model_obj = MyModel.objects.first()
model_obj.get_field_meta("my_field")
# {"key": "value"}
Or,
MyModel.get_field_meta("my_field")
# {"key": "value"}
Installation
Install from PiPy:
pip install django-model-field-meta
or, if you are using Pipenv:
pipenv install django-model-field-meta
Why metadata in model field?
In one of my Django projects, I needed to supply extra information about our model fields.
For my purpose, help_text is too limited. Using code comments is not feasible as I need to use those information programatically.
Hence, django_model_field_meta package is created.
Compatibility with third-party packages
In my project, I use:
django-model-utilsfor itsInheritanceManager.safedeletefor itsSafeDeleteModel
So far, I haven't encounter any issue. Feel free to report if you do.
Issues
If you have questions or issues using it, please create a Github issue at:
Release files for django-model-field-meta 0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-model-field-meta-0.6.tar.gz | 4.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_model_field_meta-0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.6 kB
Release files / django-model-field-meta-0.6.tar.gz
| Download URL | django-model-field-meta-0.6.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aafd3837c73c993a6635d40c032b816b444df3261f296b4c65420ad313e707c0
|
|
BLAKE2b-256 checksum How to use checksums |
8808deea9dc2f1d59b21810198c9d53b96dcb09eac63524dff35c7f337320052
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6
|
Release files / django_model_field_meta-0.6-py3-none-any.whl
| Download URL | django_model_field_meta-0.6-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8c361c65ee4d65bdbc401d32644233ea05426193106d31f2157fa4be64410c89
|
|
BLAKE2b-256 checksum How to use checksums |
813d885910fff81004b6db47704b89466b74fcc2385df62fbf2eef78c42d6858
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6
|