connect / api /admin.py
thejagstudio's picture
Upload 54 files
4618a46 verified
from django.contrib import admin
from .models import Bhagat, Event, Attendance, Notification, Region, BhajanCategory, Bhajan
from import_export.admin import ImportExportModelAdmin
# Register your models here.
class BhagatAdmin(ImportExportModelAdmin):
list_display = ('__str__', 'email', 'region', 'user_type', 'assigned_to')
list_filter = ('region', 'user_type')
search_fields = ('__str__', 'email', 'region', 'user_type', 'assigned_to')
class RegionAdmin(ImportExportModelAdmin):
list_display = ('name',)
class BhajanCategoryAdmin(ImportExportModelAdmin):
list_display = ('name', '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')
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)