new section

This commit is contained in:
Laura Klünder 2017-05-16 15:51:56 +02:00
parent bc25794e94
commit 5d72989adf
3 changed files with 3 additions and 1 deletions

View file

@ -1,6 +1,7 @@
{% load bootstrap3 %}
{% load i18n %}
<a class="btn btn-default btn-sm pull-right" accesskey="n" href="{% url 'editor.section.create' %}">{% trans 'New Section' %}</a>
<h3>{% trans 'Sections' %}</h3>
<div class="list-group">
{% for s in sections %}

View file

@ -6,4 +6,5 @@ urlpatterns = [
url(r'^$', main_index, name='editor.index'),
url(r'^sections/(?P<pk>[0-9]+)/$', section_detail, name='editor.section'),
url(r'^sections/(?P<pk>[0-9]+)/edit$', edit, name='editor.section.edit', kwargs={'model': 'Section'}),
url(r'^sections/create$', edit, name='editor.section.create', kwargs={'model': 'Section'}),
]

View file

@ -59,7 +59,7 @@ def edit(request, pk=None, model=None):
'title': obj.title if obj else None,
}
if isinstance(obj, Section):
if model == Section:
ctx.update({
'section': obj,
'back_url': reverse('editor.index') if new else reverse('editor.section', kwargs={'pk': pk}),