make all forms/views compatible with django 1.8 (#15731)

This commit is contained in:
Frédéric Péters 2017-04-03 15:00:12 +02:00
parent e1a697c433
commit 62ab9b4cbd
2 changed files with 10 additions and 2 deletions

View File

@ -80,6 +80,12 @@ class EncombrantsManagementUpdateForm(EncombrantsManagementForm):
exclude = ('users',)
class NoStreetsCommuneForm(forms.ModelForm):
class Meta:
model = Commune
exclude = ('streets',)
class CommuneForm(forms.ModelForm):
streets = forms.CharField(widget=forms.Textarea(attrs={'cols': 25, 'rows': 10}),
help_text=_('one street by line'),

View File

@ -26,8 +26,8 @@ from django.db import transaction
from passerelle import utils as passerelle_utils
from .models import EncombrantsManagement, Sector, Commune, CollectDay, Street
from .forms import EncombrantsManagementForm, EncombrantsManagementUpdateForm, CommuneForm, StreetsForm
from .forms import EncombrantsManagementForm, EncombrantsManagementUpdateForm, CommuneForm
from .forms import (EncombrantsManagementForm, EncombrantsManagementUpdateForm, CommuneForm,
StreetsForm, NoStreetsCommuneForm)
from .forms import SectorForm
from .utils import prefix_cleanup, get_sector
@ -115,6 +115,7 @@ class CommuneView(DetailView):
class CommuneUpdateView(UpdateView):
model = Commune
form_class = NoStreetsCommuneForm
template_name = 'passerelle/manage/service_form.html'
success_url = reverse_lazy('montpellier-encombrants-commune-listing')
@ -138,6 +139,7 @@ class CollectDayCreateView(CreateView):
model = CollectDay
template_name = 'passerelle/manage/service_form.html'
success_url = reverse_lazy('montpellier-encombrants-collectday-listing')
fields = '__all__'
class CollectDayDeleteView(DeleteView):