Skip to main content

Python Django package for convenient registration of models in the admin area without a boilerplate in a declarative style.

Project description

Django Admin Registrar

Has russian-locale readme version below / Есть версия на русском языке ниже

English

[!warning] This README is a "quick draft" – I'm very busy and not yet ready for the final release of the package. I plan to provide detailed documentation for each feature. Thank you for your understanding.

This package simplifies the registration of Django models in the admin site. It registers all models of a given app (AppConfig), allowing you to define default admin classes (ModelAdmin) for models and avoid having to manually register each newly added model according to project-wide rules. For example, instead of manually registering every SingletonModel subclass (from django-solo) with SingletonModelAdmin, you can specify in the package settings:

ADMIN_REGISTRAR = {
	'ADMINS_FOR_MODELS': {
		'solo.models.SingletonModel': 'solo.admin.SingletonModelAdmin'
	}
}

Now, by default, all SingletonModel subclasses will be registered with SingletonModelAdmin.

The package also offers an additional feature: "hidden models". This is a special shortcut for registering a model with HiddenAdmin – a custom admin class that registers the model in the admin panel but does not display it in the list, allowing all CRUD operations on the model without cluttering the main model list. This is useful when you have models like "Product Characteristic Type" and "Product Characteristic" that are only used within a product, and you want to create/edit/delete them from the product change form.

Russian / Русский

[!warning] Это readme "на скорую руку" - я очень занят и ещё не готов к окончательной публикации пакета. В планах подробная документация по каждой фиче проекта. Спасибо за понимание.

Этот пакет для удобной регистрации моделей (Model) в админ-панели (admin-site) Django. Он регистрирует все модели переданного приложения (AppConfig) позволяя определить админ-классы (ModelAdmin) для моделей по умолчанию и не регистрировать отдельно новую добавленную модель по установленным в проекте правилам. То есть, вместо ручной регистрации каждой модели-подтипа SingletonModel из django-solo под SingletonModelAdmin вы можете указать в насройках пакета следующее:

ADMIN_REGISTRAR = {
	'ADMINS_FOR_MODELS': {
		'solo.models.SingletonModel': 'solo.admin.SingletonModelAdmin'
	}
}

И теперь по умолчанию все SingletonModel будут регистрироваться под SingletonModelAdmin.

Также у проекта есть дополнительная фича: "скрытые модели". Это специальный шорткат для регистрации модели под HiddenAdmin - специального админ-класса, который регистрирует модель в админ панели, но не отображает её, что позволяет производить все CRUD операции над моделью, но не засорять общий список моделей. Удобно, если у вас есть модель "Тип характеристики продукта" и "Характеристика продукта", но используются они только в продукте и создавать / изменять / удалять вы их хотите из формы изменения продукта.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_admin_registrar-0.1.0b1-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file django_admin_registrar-0.1.0b1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_admin_registrar-0.1.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 21cc20db4dad8c65675b53deabb0b5a430cb8cc803bf7090b484a0dcb9d10952
MD5 af1f2733061fdcc20dfb903c28674cbb
BLAKE2b-256 1ad83268b38f14ab2a22ab1e620962faeab9f6d5c6dc9bee9a8eda9a1e42adbe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page