Changed the telechat date admin to use the 'initial-date' field value instead of the now nonfunctional form.initial dictionary. This may need revisiting under Django 1.11, which has an official api to grab a form's initial values. This fixes a server 500 error on trying to save a non-default telechat date.
- Legacy-Id: 14210
This commit is contained in:
parent
9be7d57a03
commit
7931a96460
|
@ -1,5 +1,7 @@
|
|||
from django.contrib import admin
|
||||
|
||||
import debug # pyflakes:ignore
|
||||
|
||||
from ietf.doc.models import TelechatDocEvent
|
||||
from ietf.iesg.models import TelechatDate, TelechatAgendaItem
|
||||
|
||||
|
@ -14,7 +16,7 @@ class TelechatDateAdmin(admin.ModelAdmin):
|
|||
'''
|
||||
super(TelechatDateAdmin, self).save_model(request, obj, form, change)
|
||||
if 'date' in form.changed_data:
|
||||
old_date = form.initial['date']
|
||||
old_date = form.data['initial-date']
|
||||
new_date = form.cleaned_data['date']
|
||||
TelechatDocEvent.objects.filter(telechat_date=old_date).update(telechat_date=new_date)
|
||||
|
||||
|
|
|
@ -415,7 +415,7 @@ class IESGAgendaTests(TestCase):
|
|||
telechat_date = TelechatDate.objects.get(date=draft.telechat_date())
|
||||
url = urlreverse('admin:iesg_telechatdate_change', args=(telechat_date.id,))
|
||||
self.client.login(username="secretary", password="secretary+password")
|
||||
r = self.client.post(url, {'date':today.strftime('%Y-%m-%d')})
|
||||
r = self.client.post(url, {'initial-date': telechat_date.date.strftime('%Y-%m-%d'), 'date':today.strftime('%Y-%m-%d')})
|
||||
self.assertRedirects(r, urlreverse('admin:iesg_telechatdate_changelist'))
|
||||
self.assertEqual(draft.telechat_date(),today)
|
||||
|
||||
|
|
Loading…
Reference in a new issue