|
1 | 1 | from django.contrib import admin |
| 2 | +from import_export.admin import ImportExportModelAdmin |
2 | 3 | from notices.models import Notice, BookmarkedNotice, TrendingInCollege |
3 | 4 |
|
| 5 | + |
4 | 6 | class BookmarkedNoticeAdmin(admin.TabularInline): |
5 | 7 | model = BookmarkedNotice |
6 | | - extra=1 |
| 8 | + extra = 1 |
7 | 9 | fieldsets = ( |
8 | 10 | (None, { |
9 | | - 'classes': ('extrapretty','wide'), |
| 11 | + 'classes': ('extrapretty', 'wide'), |
10 | 12 | 'fields': (('user', 'notice'), 'pinned'), |
11 | 13 | }), |
12 | 14 | ) |
13 | 15 |
|
14 | | -class NoticeAdmin(admin.ModelAdmin): |
15 | | - list_display = ('faculty', 'title', 'course_branch_year', 'created', 'modified', 'visible_for_student', |
16 | | - 'visible_for_faculty', 'visible_for_hod', 'visible_for_others', 'visible_for_management' |
17 | | - ) |
| 16 | + |
| 17 | +class NoticeAdmin(ImportExportModelAdmin): |
| 18 | + list_display = ( |
| 19 | + 'faculty', 'title', 'course_branch_year', |
| 20 | + 'created', 'modified', 'visible_for_student', |
| 21 | + 'visible_for_faculty', 'visible_for_hod', |
| 22 | + 'visible_for_others', 'visible_for_management' |
| 23 | + ) |
18 | 24 | list_display_links = ('title', 'faculty') |
19 | 25 | list_filter = ('faculty', 'category') |
20 | 26 | list_per_page = 100 |
21 | 27 | inlines = [BookmarkedNoticeAdmin] |
22 | 28 | fieldsets = ( |
23 | 29 | (None, { |
24 | 30 | 'classes': ('wide', 'extrapretty'), |
25 | | - 'fields': ('faculty', 'category', 'title', 'description', 'file_attached', 'course_branch_year', |
26 | | - 'visible_for_student', 'visible_for_faculty', 'visible_for_hod', |
27 | | - 'visible_for_others', 'visible_for_management', ), |
| 31 | + 'fields': ( |
| 32 | + 'faculty', 'category', 'title', 'description', |
| 33 | + 'file_attached', 'course_branch_year', |
| 34 | + 'visible_for_student', 'visible_for_faculty', |
| 35 | + 'visible_for_hod', |
| 36 | + 'visible_for_others', 'visible_for_management', ), |
28 | 37 | }), |
29 | 38 | ) |
30 | 39 |
|
31 | | -# class TrendingInCollegeAdmin(admin.ModelAdmin): |
32 | | -# list_display = ('title', 'attachment', 'visibility') |
| 40 | + |
| 41 | +class TrendingInCollegeAdmin(admin.ModelAdmin): |
| 42 | + list_display = ('title', 'attachment', 'visibility') |
| 43 | + |
33 | 44 |
|
34 | 45 | admin.site.register(Notice, NoticeAdmin) |
35 | | -# admin.site.register(TrendingInCollege, TrendingInCollegeAdmin) #Unused model |
| 46 | +admin.site.register(TrendingInCollege, TrendingInCollegeAdmin) |
0 commit comments