allow commune edit (#8626)

This commit is contained in:
Serghei Mihai 2015-10-13 23:25:13 +02:00
parent 944094c4b8
commit aba220d7b6
3 changed files with 9 additions and 0 deletions

View File

@ -9,6 +9,7 @@
{% block appbar %}
<h2>{{ commune }}</h2>
<a rel="popup" href="{% url 'montpellier-encombrants-commune-streets-edit-view' pk=commune.pk %}">{% trans 'Edit streets' %}</a>
<a rel="popup" href="{% url 'montpellier-encombrants-commune-edit' pk=commune.pk %}">{% trans 'Edit' %}</a>
{% endblock %}
{% block content %}

View File

@ -46,6 +46,8 @@ management_urlpatterns = patterns('',
name='montpellier-encombrants-commune-listing'),
url(r'^communes/add$', CommuneCreateView.as_view(),
name='montpellier-encombrants-commune-add'),
url(r'^communes/(?P<pk>[\w,-]+)/edit$', CommuneUpdateView.as_view(),
name='montpellier-encombrants-commune-edit'),
url(r'^communes/(?P<pk>[\w,-]+)$', CommuneView.as_view(),
name='montpellier-encombrants-commune-view'),
url(r'^communes/(?P<pk>[\w,-]+)/streets$', StreetEditView.as_view(),

View File

@ -113,6 +113,12 @@ class CommuneView(DetailView):
return context
class CommuneUpdateView(UpdateView):
model = Commune
template_name = 'passerelle/manage/service_form.html'
success_url = reverse_lazy('montpellier-encombrants-commune-listing')
class CommuneDeleteView(DeleteView):
model = Commune
template_name = 'passerelle/manage/service_confirm_delete.html'