forked from adamlaska/datatracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.py
More file actions
24 lines (18 loc) · 941 Bytes
/
admin.py
File metadata and controls
24 lines (18 loc) · 941 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from django.contrib import admin
import debug # pyflakes:ignore
from ietf.doc.models import TelechatDocEvent
from ietf.iesg.models import TelechatDate, TelechatAgendaItem
class TelechatAgendaItemAdmin(admin.ModelAdmin):
pass
admin.site.register(TelechatAgendaItem, TelechatAgendaItemAdmin)
class TelechatDateAdmin(admin.ModelAdmin):
def save_model(self, request, obj, form, change):
'''If changing a Telechat date, change all related TelechatDocEvents, which is how
documents are related to the Telechat
'''
super(TelechatDateAdmin, self).save_model(request, obj, form, change)
if 'date' in form.changed_data:
old_date = form.data['initial-date']
new_date = form.cleaned_data['date']
TelechatDocEvent.objects.filter(telechat_date=old_date).update(telechat_date=new_date)
admin.site.register(TelechatDate, TelechatDateAdmin)