datatracker/ietf/iesg/admin.py
Jennifer Richards 372891194e
feat: Move IESG agenda items from filesystem to DB (#5366)
* feat: Add TelechatAgendaContent model and related support

* feat: Add UI for managing TelechatAgendaContents

* refactor: Rename _view view to _manage

* feat: Add a view to dump the TelechatAgendaContent as text/plain

* refactor: Point agenda_data() helpers at content in the DB

* refactor: Replace references to settings URLs/paths with new plumbing

* chore: Remove now-obsolete settings from settings.py

* feat: Link to telechat_agenda_content_manage view from iesg agenda

* fix: Use correct view name

* feat: Link from agenda content management page to IESG agenda view

* chore: Create resources

* chore: Add new names to names.json

* chore: Renumber migration after rebase

* chore: Remove unused import

* fix: Clean up partially removed code

* chore: Add admin model for TelechatAgendaContent

* chore: Simplify __str__ method for TelechatAgendaContent

* test: Add TelechatAgendaContentFactory

* test: Test the fill_in_agenda_administrivia() function

* test: Test that agenda contains action_items content

* test: Test that sensitive agenda links are restricted by role

* test: Test the telechat_agenda_content_view view

* test: Add test of telechat_agenda_content_edit view

* fix: Add type attribute to button to satisfy html validator

* test: Filter TelechatAgendaSectionName to used=True for tests

* test: More thoroughly test for likely(ish) permission errors

* fix: Fix typo in "tablist" role

* test: Test telechat_agenda_content_manage view

* style: Put back newlines at EOF

* chore: Add admin for TelechatAgendaSectionName

* chore: Renumber migrations

* fix: Depend on the correct migration

Forgot to update the number, but was also depending on the wrong
migration.
2023-04-23 18:05:58 -05:00

28 lines
1.1 KiB
Python

from django.contrib import admin
import debug # pyflakes:ignore
from ietf.doc.models import TelechatDocEvent
from ietf.iesg.models import TelechatDate, TelechatAgendaItem, TelechatAgendaContent
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)
class TelechatAgendaContentAdmin(admin.ModelAdmin):
list_display = ('section',)
admin.site.register(TelechatAgendaContent, TelechatAgendaContentAdmin)