diff --git a/AUTHORS.rst b/AUTHORS.rst index 22d0df7..9b76611 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -15,3 +15,4 @@ Developers * Andrew Ingram (@AndrewIngram) * Gregor Müllegger (@gregmuellegger) * Rivo Laks (@rivol) +* Chris Lawlor (@chrislawlor) diff --git a/djadmin2/templates/admin2/bootstrap/base.html b/djadmin2/templates/admin2/bootstrap/base.html index 4a8134a..445b587 100644 --- a/djadmin2/templates/admin2/bootstrap/base.html +++ b/djadmin2/templates/admin2/bootstrap/base.html @@ -3,7 +3,7 @@ - django-admin2 + {% block title %}Site administration{% endblock %} | django-admin2 @@ -46,6 +46,11 @@
+
+
+

{% block page_title %}Site administration{% endblock %}

+
+
{% block content %}{% endblock %}
diff --git a/djadmin2/templates/admin2/bootstrap/index.html b/djadmin2/templates/admin2/bootstrap/index.html index 046863d..5a1cc3d 100644 --- a/djadmin2/templates/admin2/bootstrap/index.html +++ b/djadmin2/templates/admin2/bootstrap/index.html @@ -2,7 +2,6 @@ {% load admin2_tags %} {% block content %} -

Site administration

diff --git a/djadmin2/templates/admin2/bootstrap/model_add_form.html b/djadmin2/templates/admin2/bootstrap/model_add_form.html index 2fac865..f18b91a 100644 --- a/djadmin2/templates/admin2/bootstrap/model_add_form.html +++ b/djadmin2/templates/admin2/bootstrap/model_add_form.html @@ -1,5 +1,9 @@ {% extends "admin2/bootstrap/base.html" %} +{% block title %}Add {{ model }}{% endblock %} + +{% block page_title %}Add {{ model }}{% endblock %} + {% block content %}
diff --git a/djadmin2/templates/admin2/bootstrap/model_confirm_delete.html b/djadmin2/templates/admin2/bootstrap/model_confirm_delete.html index 7c7b742..6025b9a 100644 --- a/djadmin2/templates/admin2/bootstrap/model_confirm_delete.html +++ b/djadmin2/templates/admin2/bootstrap/model_confirm_delete.html @@ -1,10 +1,16 @@ {% extends "admin2/bootstrap/base.html" %} +{% block title %}Are you sure?{% endblock %} + +{% block page_title %}Are you sure?{% endblock %} + {% block content %} +

Are you sure you want to delete the {{ model }} "{{ object }}"? All of the following related items will be deleted:

+ +TODO {% csrf_token %} - delete {{ object }} {{ form.as_p }}
diff --git a/djadmin2/templates/admin2/bootstrap/model_detail.html b/djadmin2/templates/admin2/bootstrap/model_detail.html index 0b7b55c..fe098a5 100644 --- a/djadmin2/templates/admin2/bootstrap/model_detail.html +++ b/djadmin2/templates/admin2/bootstrap/model_detail.html @@ -1,5 +1,9 @@ {% extends "admin2/bootstrap/base.html" %} +{% block title %}{{ object }}{% endblock %} + +{% block page_title %}{{ object }}{% endblock %} + {% block content %} {{ object }} diff --git a/djadmin2/templates/admin2/bootstrap/model_edit_form.html b/djadmin2/templates/admin2/bootstrap/model_edit_form.html index 76f8a45..a130e31 100644 --- a/djadmin2/templates/admin2/bootstrap/model_edit_form.html +++ b/djadmin2/templates/admin2/bootstrap/model_edit_form.html @@ -1,14 +1,11 @@ {% extends "admin2/bootstrap/base.html" %} +{% block title %}Change {{ model }}{% endblock %} + +{% block page_title %}Change {{ model }}{% endblock %} + {% block content %} -
-
-

Change {{ model }}

-
-
- -
diff --git a/djadmin2/templates/admin2/bootstrap/model_list.html b/djadmin2/templates/admin2/bootstrap/model_list.html index 0ee41e1..3ec9c53 100644 --- a/djadmin2/templates/admin2/bootstrap/model_list.html +++ b/djadmin2/templates/admin2/bootstrap/model_list.html @@ -1,13 +1,11 @@ {% extends "admin2/bootstrap/base.html" %} {% load admin2_tags %} -{% block content %} -
-
-

Select {{ model }} to change

-
-
+{% block title %}Select {{ model }} to change{% endblock %} +{% block page_title %}Select {{ model }} to change{% endblock %} + +{% block content %}
diff --git a/djadmin2/views.py b/djadmin2/views.py index 5cf8c83..179959c 100644 --- a/djadmin2/views.py +++ b/djadmin2/views.py @@ -57,6 +57,8 @@ class AdminModel2Mixin(Admin2Mixin, AccessMixin): 'has_add_permission': self.model_admin.has_add_permission(self.request), 'has_edit_permission': self.model_admin.has_edit_permission(self.request), 'has_delete_permission': self.model_admin.has_delete_permission(self.request), + 'model': self.get_model()._meta.verbose_name, + 'model_pluralized': self.get_model()._meta.verbose_name_plural }) return context @@ -87,7 +89,6 @@ class IndexView(Admin2Mixin, generic.TemplateView): class ModelListView(Admin2Mixin, generic.ListView): - default_template_name = "model_list.html" permission_type = 'view' @@ -113,11 +114,6 @@ class ModelEditFormView(AdminModel2Mixin, generic.UpdateView): default_template_name = "model_edit_form.html" permission_type = 'change' - def get_context_data(self, **kwargs): - context = super(ModelEditFormView, self).get_context_data(**kwargs) - context['model'] = self.get_model()._meta.verbose_name - return context - class ModelAddFormView(AdminModel2Mixin, generic.CreateView): form_class = None @@ -125,6 +121,11 @@ class ModelAddFormView(AdminModel2Mixin, generic.CreateView): default_template_name = "model_add_form.html" permission_type = 'add' + def get_context_data(self, **kwargs): + context = super(ModelAddFormView, self).get_context_data(**kwargs) + context['model'] = self.get_model()._meta.verbose_name + return context + def get_success_url(self): view_name = 'admin2:{}_{}_detail'.format(self.app_label, self.model_name) return reverse(view_name, kwargs={'pk': self.object.pk})