1. Poul Sysolyatin
  2. django-russian-admin

Commits

Poul Sysolyatin  committed afbb010

Updated for django 1.4 support

  • Participants
  • Parent commits 0172363
  • Branches default

Comments (0)

Files changed (4)

File russian_admin/__init__.py

View file
-VERSION = (0, 1, 0, "alpha", 3)
+VERSION = (0, 1, 0, "alpha", 6)
 
 def get_version():
     version = '%s.%s' % (VERSION[0], VERSION[1])

File russian_admin/breadcrumbs.py

View file
     def __init__(self, function):
         self.target = function
         self.app_label = u''
+        self.current_name = u''
 
     def rename(self, f, name = u''):
         def wrapper(*args, **kwargs):
             extra_context = kwargs.get('extra_context', {})
             if 'delete_view' != f.__name__:
-                extra_context['title'] = self.get_title_by_name(f.__name__, args[1], name)
+                extra_context['title'] = self.get_title_by_name(f.__name__, args[1], self.current_name)
             else:
                 extra_context['object_name'] = morph.inflect_ru(self.current_name, u'вн').lower()
             kwargs['extra_context'] = extra_context
                 admin_class = type(model.__name__+'Admin', (admin.ModelAdmin,), {})
 
             self.app_label = model._meta.app_label
-            current_name = model._meta.verbose_name.upper()
-            admin_class.add_view = self.rename(admin_class.add_view, current_name)
-            admin_class.change_view = self.rename(admin_class.change_view, current_name)
-            admin_class.changelist_view = self.rename(admin_class.changelist_view, current_name)
-            admin_class.delete_view = self.rename(admin_class.delete_view, current_name)
+            self.current_name = model._meta.verbose_name.upper()
+            admin_class.add_view = self.rename(admin_class.add_view)
+            admin_class.change_view = self.rename(admin_class.change_view)
+            admin_class.changelist_view = self.rename(admin_class.changelist_view)
+            admin_class.delete_view = self.rename(admin_class.delete_view)
         return self.target(model, admin_class, **option)
 
 

File russian_admin/templates/russian_admin/admin/change_form.html

View file
 {% extends "admin/base_site.html" %}
-{% load i18n admin_modify adminmedia pymorphy_tags %}
+{% load i18n admin_modify admin_static pymorphy_tags %}
 {% load url from future %}
 
 {% block extrahead %}{{ block.super }}
 {{ media }}
 {% endblock %}
 
-{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/forms.css" />{% endblock %}
+{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}" />{% endblock %}
 
 {% block coltype %}{% if ordered_objects %}colMS{% else %}colM{% endif %}{% endblock %}
 

File russian_admin/templates/russian_admin/admin/change_list.html

View file
 {% extends "admin/base_site.html" %}
-{% load adminmedia admin_list i18n pymorphy_tags %}
-{% load url from future %}
+{% load admin_list i18n pymorphy_tags admin_static %}{% load url from future %}
 {% block extrastyle %}
   {{ block.super }}
-  <link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/changelists.css" />
+  <link rel="stylesheet" type="text/css" href="{% static "admin/css/changelists.css" %}" />
   {% if cl.formset %}
-    <link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/forms.css" />
+    <link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}" />
   {% endif %}
   {% if cl.formset or action_form %}
     {% url 'admin:jsi18n' as jsi18nurl %}