generators module¶
Model introspection and admin.py source generation.
- class django_admin_generator.generators.AdminApp(app, model_res, **options)[source]¶
Bases:
objectRender the admin classes for every (matching) model in an app.
- Parameters:
app (AppConfig)
model_res (list[re.Pattern[str]])
options (Any)
- class django_admin_generator.generators.AdminModel(model, raw_id_threshold=100, date_hierarchy_threshold=250, list_filter_threshold=25, search_field_names=('name', 'slug'), date_hierarchy_names=('joined_at', 'updated_at', 'created_at'), prepopulated_field_names=('slug=name',), no_query_db=False, auto_complete=None, disable_auto_complete=False, **options)[source]¶
Bases:
objectIntrospect a single model and render its
ModelAdminbody.- Parameters:
- PRINTABLE_PROPERTIES: ClassVar[tuple[str, ...]] = ('list_display', 'list_filter', 'raw_id_fields', 'autocomplete_fields', 'search_fields', 'prepopulated_fields', 'date_hierarchy')¶
- NON_DISTINCT_FIELDS: ClassVar[tuple[type[AnyField], ...]] = (<class 'django.db.models.fields.TextField'>, <class 'django.db.models.fields.json.JSONField'>, <class 'django.db.models.fields.BinaryField'>, <class 'django.db.models.fields.files.FileField'>)¶
Field types that do not support
DISTINCTon some databases (PostgreSQL, Oracle, SQL Server) and must be kept out of thedistinct()queries used to populatelist_filter.