mirror of
https://github.com/jazzband/django-admin2.git
synced 2026-04-11 18:31:03 +00:00
Add an action_name context variable to model form views
This commit is contained in:
parent
8c399fadf8
commit
847d0ee78f
2 changed files with 7 additions and 5 deletions
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
{% load admin2_tags i18n %}
|
||||
|
||||
{% block title %}{% blocktrans with action=action model_name=model_name %}{{ action }} {{ model_name }}{% endblocktrans %}{% endblock title %}
|
||||
{% block title %}{% blocktrans with action=action model_name=model_name %}{{ action_name }} {{ model_name }}{% endblocktrans %}{% endblock title %}
|
||||
|
||||
{% block page_title %}{% blocktrans with action=action model_name=model_name %}{{ action }} {{ model_name }}{% endblocktrans %}{% endblock page_title %}
|
||||
{% block page_title %}{% blocktrans with action=action model_name=model_name %}{{ action_name }} {{ model_name }}{% endblocktrans %}{% endblock page_title %}
|
||||
|
||||
{% block breadcrumbs %}
|
||||
<li>
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
<span class="divider">/</span>
|
||||
</li>
|
||||
{% if action == 'Add' %}
|
||||
<li class="active">{{ action }}</li>
|
||||
<li class="active">{{ action_name }}</li>
|
||||
{% else %}
|
||||
<li>
|
||||
<a href="{% url view|admin2_urlname:"detail" pk=object.pk %}">{{ object }}</a>
|
||||
|
|
|
|||
|
|
@ -179,7 +179,8 @@ class ModelEditFormView(AdminModel2Mixin, Admin2ModelFormMixin, extra_views.Upda
|
|||
def get_context_data(self, **kwargs):
|
||||
context = super(ModelEditFormView, self).get_context_data(**kwargs)
|
||||
context['model'] = self.get_model()
|
||||
context['action'] = ugettext_lazy("Change")
|
||||
context['action'] = "Change"
|
||||
context['action_name'] = ugettext_lazy("Change")
|
||||
return context
|
||||
|
||||
|
||||
|
|
@ -199,7 +200,8 @@ class ModelAddFormView(AdminModel2Mixin, Admin2ModelFormMixin, extra_views.Creat
|
|||
def get_context_data(self, **kwargs):
|
||||
context = super(ModelAddFormView, self).get_context_data(**kwargs)
|
||||
context['model'] = self.get_model()
|
||||
context['action'] = ugettext_lazy("Add")
|
||||
context['action'] = "Add"
|
||||
context['action_name'] = ugettext_lazy("Add")
|
||||
return context
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue