From: williambratches Date: Tue, 25 Mar 2014 21:15:06 +0000 (-0400) Subject: repaired Department and Professor dependencies X-Git-Tag: release-20150131~144^2~12^2~3 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=0148b823e82685c6b32bd6884e3b972278c9023f;p=oweals%2Fkarmaworld.git repaired Department and Professor dependencies --- diff --git a/karmaworld/apps/courses/admin.py b/karmaworld/apps/courses/admin.py index e26ac25..f2b7fa0 100644 --- a/karmaworld/apps/courses/admin.py +++ b/karmaworld/apps/courses/admin.py @@ -18,6 +18,12 @@ class CourseAdmin(reversion.VersionAdmin, admin.ModelAdmin): autocomplete_lookup_fields = { 'fk': ['school'] } +class DepartmentAdmin(reversion.VersionAdmin, admin.ModelAdmin): + """ Admin handler for Department model """ + + +class ProfessorAdmin(reversion.VersionAdmin, admin.ModelAdmin): + """ Admin handler for Professor model """ admin.site.register(School) admin.site.register(Professor) diff --git a/karmaworld/apps/courses/models.py b/karmaworld/apps/courses/models.py index 573bfe4..ad083d1 100644 --- a/karmaworld/apps/courses/models.py +++ b/karmaworld/apps/courses/models.py @@ -4,7 +4,7 @@ """ Models for the courses django app. - Handles courses, and their related models + Handles courses, and their related modelsl Courses are the first class object, they contain notes. Courses have a manytoone relation to schools. """ diff --git a/karmaworld/apps/moderation/admin.py b/karmaworld/apps/moderation/admin.py index e99d535..4b14b81 100644 --- a/karmaworld/apps/moderation/admin.py +++ b/karmaworld/apps/moderation/admin.py @@ -8,6 +8,11 @@ from karmaworld.apps.courses.admin import CourseAdmin from karmaworld.apps.notes.models import Note from karmaworld.apps.notes.admin import NoteAdmin from karmaworld.apps.moderation import moderator +from karmaworld.apps.courses.models import Professor +from karmaworld.apps.courses.admin import ProfessorAdmin +from karmaworld.apps.courses.models import Department +from karmaworld.apps.courses.admin import DepartmentAdmin + # Create a simple action to reset flags to zero. @@ -33,7 +38,7 @@ show_notes.short_description = "Show selected notes" class CourseModerator(CourseAdmin): date_heirarchy = 'updated_at' # Identify fields to display on the Change page - list_display = ('name', 'flags', 'url', 'updated_at', 'department','professor') + list_display = ('name', 'flags', 'url', 'updated_at', 'department',) # Sort by highest number of flags first, and then by date for ties. ordering = ('-flags', '-updated_at') # Enable resetting flags @@ -51,7 +56,7 @@ class NoteModerator(NoteAdmin): actions = (reset_flags, hide_notes, show_notes) # Structure views of Department objects -class DepartmentModerator(NoteAdmin): +class DepartmentModerator(DepartmentAdmin): date_heirarchy = 'uploaded_at' # Identify fields to display on the Change page list_display = ('name', 'school', 'url') @@ -61,7 +66,7 @@ class DepartmentModerator(NoteAdmin): actions = (reset_flags,) # Structure views of Professor objects -class ProfessorModerator(NoteAdmin): +class ProfessorModerator(ProfessorAdmin): date_heirarchy = 'uploaded_at' # Identify fields to display on the Change page list_display = ('name', 'email')