Django model field list field
This is a Django model field that provides a list of some other model's fields. Fields can be multi-selected and "under the hood" are stored as a comma-separated string. Also package provides simple form field with the same capabilities.
Requirements
- Python 2.7+ or Python 3.3+
- Django 1.11+
Installation
Install django-mflf using pip:
pip install django-mflf
Add model_field_list to INSTALLED_APPS. Example:
INSTALLED_APPS = (
...
'model_field_list',
...
)
Example usage
Model field:
from model_field_list import ModelFieldListField
class ProductKind(models.Model):
name = models.CharField(max_length=100)
comparison = ModelFieldListField('comparison criteria', source_model=Product)
If referenced model has many fields it would be useful to use FilteredSelectMultiple in Django admin:
from django.contrib.admin.widgets import FilteredSelectMultiple
class ProductKindAdminForm(forms.ModelForm):
class Meta:
widgets = {
# different widget label is intentional
'comparison': FilteredSelectMultiple('product properties', False)
}
Simple form field:
from django.contrib.admin.widgets import FilteredSelectMultiple
from model_field_list import ModelFieldListFormField
class ProductExportForm(ExportForm):
export_fields = ModelFieldListFormField(source_model=Product, label='Export fields',
widget=FilteredSelectMultiple('свойства товара', False))
Limitations
- All model fields are listed, no option to filter them in any way.
- Field order can't be customized - they are sorted by the order of their definition in a model.
Metadata
Release files for django-mflf 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-mflf-0.1.0.tar.gz | 6.7 kB | Without provenance | Details for django-mflf-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_mflf-0.1.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for django_mflf-0.1.0-py2.py3-none-any.whl |
Total release size: 15.7 kB
Release files / django-mflf-0.1.0.tar.gz
| Download URL | django-mflf-0.1.0.tar.gz |
|---|---|
| Size | 6.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
48c5f82a7d4c5d92ab66dd530c93f98f0f413c98a0bfb9b7e280f21ac8e1e0f9
|
|
BLAKE2b-256 checksum How to use checksums |
0fde80bbbb1621523d2122581899298c5ba92025b3fa60133f6bfde7bda8e0d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.10.2
|
Release files / django_mflf-0.1.0-py2.py3-none-any.whl
| Download URL | django_mflf-0.1.0-py2.py3-none-any.whl |
|---|---|
| Size | 8.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
cc8b453d97136f2b0929b6ed143d0485166ffb413be3c8c8ba7bfbd778ae80c2
|
|
BLAKE2b-256 checksum How to use checksums |
373e05981e269977db03baf03667db39d6af8476d5fa3b36efc3649885e6b00f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.10.2
|
Security for django-mflf 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.