Spaces:
Sleeping
Sleeping
| from django.contrib import admin | |
| from .models import ( | |
| Bhagat, | |
| Event, | |
| Attendance, | |
| Notification, | |
| Region, | |
| BhajanCategory, | |
| Bhajan, | |
| PushSubscription, | |
| OptionPoll, | |
| Poll, | |
| Books, | |
| Sections, | |
| Chapters, | |
| Gallery, | |
| Wallpaper | |
| ) | |
| from import_export.admin import ImportExportModelAdmin | |
| # Register your models here. | |
| class BhagatAdmin(ImportExportModelAdmin): | |
| list_display = ( | |
| "get_full_name", | |
| "profileImage", | |
| "email", | |
| "region", | |
| "user_type", | |
| "assigned_to", | |
| ) | |
| list_filter = ("region", "user_type") | |
| search_fields = ( | |
| "get_full_name", | |
| "email", | |
| "region", | |
| "user_type", | |
| "assigned_to", | |
| ) | |
| class RegionAdmin(ImportExportModelAdmin): | |
| list_display = ("name",) | |
| class BhajanCategoryAdmin(ImportExportModelAdmin): | |
| list_display = ("name", "icon_image", "link") | |
| search_fields = ("name",) | |
| class BhajanAdmin(ImportExportModelAdmin): | |
| list_display = ("title", "title_guj", "category", "lyricsBtn") | |
| search_fields = ("title", "title_guj", "category__name") | |
| list_filter = ("category",) | |
| # 'musicPreivew', | |
| class EventAdmin(ImportExportModelAdmin): | |
| list_display = ("title", "date", "region", "is_approved", "color") | |
| list_filter = ("region", "is_approved", "color") | |
| search_fields = ("title", "date", "region", "is_approved", "color") | |
| list_editable = ("is_approved", "color") | |
| class NotificationAdmin(ImportExportModelAdmin): | |
| list_display = ("sender", "title", "timestamp", "notification_type") | |
| list_filter = ("notification_type",) | |
| search_fields = ("sender__first_name", "title", "notification_type") | |
| class PushSubscriptionAdmin(ImportExportModelAdmin): | |
| list_display = ("user", "endpoint") | |
| class OptionPollAdmin(ImportExportModelAdmin): | |
| list_display = ("optionText",) | |
| search_fields = ("optionText",) | |
| class PollAdmin(ImportExportModelAdmin): | |
| list_display = ("question", "created_by", "created_at") | |
| search_fields = ("question", "created_by") | |
| class BooksAdmin(ImportExportModelAdmin): | |
| list_display = ("title","index", "isPdf", "hasSections", "urlId") | |
| search_fields = ("title","index", "isPdf", "hasSections", "urlId") | |
| # list_editable = ("index",) | |
| class SectionsAdmin(ImportExportModelAdmin): | |
| list_display = ("title", "isPdf", "hasChapters", "urlId","book__title") | |
| search_fields = ("title", "isPdf", "hasChapters", "urlId","book__title") | |
| class ChaptersAdmin(ImportExportModelAdmin): | |
| list_display = ("title", "isPdf", "urlId","book__title", "section__title") | |
| search_fields = ("title", "isPdf", "urlId","book__title", "section__title") | |
| class GalleryAdmin(ImportExportModelAdmin): | |
| list_display = ("image_tag", "date", "region", "uploaded_at") | |
| list_filter = ("region", "date") | |
| search_fields = ("region__name",) | |
| readonly_fields = ("uploaded_at", "date") | |
| class WallpaperAdmin(ImportExportModelAdmin): | |
| list_display = ("image_tag", "uploaded_at") | |
| readonly_fields = ("uploaded_at",) | |
| admin.site.register(Bhagat, BhagatAdmin) | |
| admin.site.register(Region, RegionAdmin) | |
| admin.site.register(BhajanCategory, BhajanCategoryAdmin) | |
| admin.site.register(Bhajan, BhajanAdmin) | |
| admin.site.register(Event, EventAdmin) | |
| admin.site.register(Notification, NotificationAdmin) | |
| admin.site.register(PushSubscription, PushSubscriptionAdmin) | |
| admin.site.register(OptionPoll, OptionPollAdmin) | |
| admin.site.register(Poll, PollAdmin) | |
| admin.site.register(Books, BooksAdmin) | |
| admin.site.register(Sections, SectionsAdmin) | |
| admin.site.register(Chapters, ChaptersAdmin) | |
| admin.site.register(Gallery, GalleryAdmin) | |
| admin.site.register(Wallpaper, WallpaperAdmin) | |