mirror of
https://github.com/jazzband/django-admin2.git
synced 2026-03-16 22:20:24 +00:00
Adds page title to model create page
This commit is contained in:
parent
b0abe58121
commit
32f5e4802f
2 changed files with 6 additions and 0 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
{% block content %}
|
||||
|
||||
<h3>Add {{ model|capfirst }}</h3>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
|
|
|
|||
|
|
@ -125,6 +125,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})
|
||||
|
|
|
|||
Loading…
Reference in a new issue