mirror of
https://github.com/Hopiu/django-rosetta.git
synced 2026-03-16 21:30:24 +00:00
Rosetta at admin panel
This commit is contained in:
parent
d89248e53f
commit
69a305927e
4 changed files with 44 additions and 1 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -16,4 +16,4 @@ testproject/src/
|
|||
testproject/.coverage
|
||||
.tox
|
||||
.eggs
|
||||
|
||||
.idea
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
VERSION = (0, 7, 13)
|
||||
default_app_config = "rosetta.apps.RosettaAppConfig"
|
||||
|
||||
|
||||
def get_version(svn=False, limit=3):
|
||||
|
|
|
|||
40
rosetta/apps.py
Normal file
40
rosetta/apps.py
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
from django.apps import AppConfig
|
||||
from django.views.decorators.cache import never_cache
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from rosetta.conf import settings as rosetta_settings
|
||||
|
||||
|
||||
class RosettaAppConfig(AppConfig):
|
||||
name = 'rosetta'
|
||||
|
||||
def ready(self):
|
||||
from django.contrib import admin
|
||||
from django.contrib.admin import sites
|
||||
|
||||
class RosettaAdminSite(admin.AdminSite):
|
||||
@never_cache
|
||||
def index(self, request, extra_context=None):
|
||||
resp = super(RosettaAdminSite, self).index(request,
|
||||
extra_context)
|
||||
app_dict = {
|
||||
'app_url': reverse('rosetta-home'),
|
||||
'models': [
|
||||
{
|
||||
'admin_url': reverse('rosetta-home'),
|
||||
'name': _('Browse'),
|
||||
'add_url': None
|
||||
},
|
||||
],
|
||||
'has_module_perms': True,
|
||||
'name': _('Transplations'),
|
||||
'app_label': 'rosetta'
|
||||
}
|
||||
resp.context_data['app_list'].append(app_dict)
|
||||
return resp
|
||||
|
||||
if rosetta_settings.SHOW_AT_ADMIN_PANEL:
|
||||
rosetta = RosettaAdminSite()
|
||||
admin.site = rosetta
|
||||
sites.site = rosetta
|
||||
|
|
@ -86,3 +86,5 @@ ROSETTA_LANGUAGE_GROUPS = getattr(settings, 'ROSETTA_LANGUAGE_GROUPS', False)
|
|||
|
||||
# Determines whether the MO file is automatically compiled when the PO file is saved.
|
||||
AUTO_COMPILE = getattr(settings, 'ROSETTA_AUTO_COMPILE', True)
|
||||
|
||||
SHOW_AT_ADMIN_PANEL = getattr(settings, 'SHOW_AT_ADMIN_PANEL', False)
|
||||
|
|
|
|||
Loading…
Reference in a new issue