Skip to content

Commit 7931a96

Browse files
committed
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
1 parent 9be7d57 commit 7931a96

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

ietf/iesg/admin.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from django.contrib import admin
22

3+
import debug # pyflakes:ignore
4+
35
from ietf.doc.models import TelechatDocEvent
46
from ietf.iesg.models import TelechatDate, TelechatAgendaItem
57

@@ -14,7 +16,7 @@ def save_model(self, request, obj, form, change):
1416
'''
1517
super(TelechatDateAdmin, self).save_model(request, obj, form, change)
1618
if 'date' in form.changed_data:
17-
old_date = form.initial['date']
19+
old_date = form.data['initial-date']
1820
new_date = form.cleaned_data['date']
1921
TelechatDocEvent.objects.filter(telechat_date=old_date).update(telechat_date=new_date)
2022

ietf/iesg/tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ def test_admin_change(self):
415415
telechat_date = TelechatDate.objects.get(date=draft.telechat_date())
416416
url = urlreverse('admin:iesg_telechatdate_change', args=(telechat_date.id,))
417417
self.client.login(username="secretary", password="secretary+password")
418-
r = self.client.post(url, {'date':today.strftime('%Y-%m-%d')})
418+
r = self.client.post(url, {'initial-date': telechat_date.date.strftime('%Y-%m-%d'), 'date':today.strftime('%Y-%m-%d')})
419419
self.assertRedirects(r, urlreverse('admin:iesg_telechatdate_changelist'))
420420
self.assertEqual(draft.telechat_date(),today)
421421

0 commit comments

Comments
 (0)