Django admin enhancer
Project description
=====
Translate app names and allow singletons
=====
This is a simple Django app to enable translation of app names in
Django admin and allow the use of singletons.
When an object is marked as a singleton only one instance will be allowed to exist.
Detailed documentation is in the "docs" directory.
Quick start
-----------
1. Add "django_singleton_app_name" to your INSTALLED_APPS setting like this::
INSTALLED_APPS = (
...
'django_singleton_app_name',
)
2. Copy templates from django-admin-app-names-singleton/templates
to your project's template directory.
All app names will now be translated when possible.
In order to add app names to .po files via "makemessages"
create a python file "app_names.py" next to your "settings.py" file
and paste the following import into it:
"from django.utils.translation import ugettext_lazy as _".
For each app you want to mark for translation add a line such as the following:
_("<app_name>")
Example:
_("auth")
3. To mark a model as a singleton you must subclass that model from
"django_singleton_app_name.models.SingletonBaseModel"
And create a ModelAdmin for that model that subclasses
"django_singleton_app_name.admin.SingletonModelAdmin"
and overwrite the ModelAdmin's member "model" with the Model's class
Example:
class ContactInformation(SingletonBaseModel):
address = models.CharField(max_length=65)
email = models.EmailField()
class ContactInfoAdmin(SingletonModelAdmin):
model = ContactInformation
Translate app names and allow singletons
=====
This is a simple Django app to enable translation of app names in
Django admin and allow the use of singletons.
When an object is marked as a singleton only one instance will be allowed to exist.
Detailed documentation is in the "docs" directory.
Quick start
-----------
1. Add "django_singleton_app_name" to your INSTALLED_APPS setting like this::
INSTALLED_APPS = (
...
'django_singleton_app_name',
)
2. Copy templates from django-admin-app-names-singleton/templates
to your project's template directory.
All app names will now be translated when possible.
In order to add app names to .po files via "makemessages"
create a python file "app_names.py" next to your "settings.py" file
and paste the following import into it:
"from django.utils.translation import ugettext_lazy as _".
For each app you want to mark for translation add a line such as the following:
_("<app_name>")
Example:
_("auth")
3. To mark a model as a singleton you must subclass that model from
"django_singleton_app_name.models.SingletonBaseModel"
And create a ModelAdmin for that model that subclasses
"django_singleton_app_name.admin.SingletonModelAdmin"
and overwrite the ModelAdmin's member "model" with the Model's class
Example:
class ContactInformation(SingletonBaseModel):
address = models.CharField(max_length=65)
email = models.EmailField()
class ContactInfoAdmin(SingletonModelAdmin):
model = ContactInformation
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for django-admin-app-names-singleton-1.0.zip
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6a074e4818a6f265e13c0c8fd194131ed968776ebda3c12f1e71dc11767dfaf |
|
MD5 | 8419827532bff252aea529d0416a2739 |
|
BLAKE2b-256 | 54d8add89faa8cf535a04a62bba35f6dbeaceb5d7fec3e90d8be22a33ec3cf15 |
Close
Hashes for django-admin-app-names-singleton-1.0.win32.exe
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd311aeb1200a08963f27237b9ad48983478d0d64bd9a45a8d221fb72c4dc404 |
|
MD5 | 77a8cf18e47671323f611702eb78fa13 |
|
BLAKE2b-256 | bda9d7223b369e381ea365ca98fda740d297d01be062a5739f06b9488790af5e |