Skip to content

Commit ad34f5b

Browse files
committed
feat: update admin
1 parent d9f9332 commit ad34f5b

File tree

2 files changed

+87
-2
lines changed

2 files changed

+87
-2
lines changed

app/speakers/admin.py

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,71 @@
11
from django.contrib import admin
22

3-
# Register your models here.
3+
from app.speakers.models import Speaker, SpeakerPresentation, SpeakerSchedule, SpeakerSocial
4+
5+
6+
class SpeakerSocialInline(admin.TabularInline):
7+
model = SpeakerSocial
8+
extra = 1
9+
fields = ("platform", "username", "url")
10+
11+
12+
class SpeakerPresentationInline(admin.TabularInline):
13+
model = SpeakerPresentation
14+
extra = 1
15+
fields = ("title", "presentation_type", "description", "abstract")
16+
17+
18+
@admin.register(Speaker)
19+
class SpeakerAdmin(admin.ModelAdmin):
20+
list_display = ("full_name", "title", "email", "is_featured", "created_at")
21+
list_filter = ("is_featured", "created_at", "updated_at")
22+
search_fields = ("first_name", "last_name", "email", "title")
23+
list_editable = ("is_featured",)
24+
readonly_fields = ("created_at", "updated_at")
25+
26+
fieldsets = (
27+
("Personal Information", {"fields": ("first_name", "last_name", "middle_name", "title")}),
28+
("Contact & Media", {"fields": ("email", "photo_url")}),
29+
("Content", {"fields": ("introduction", "bio")}),
30+
("Settings", {"fields": ("is_featured",)}),
31+
("Timestamps", {"fields": ("created_at", "updated_at"), "classes": ("collapse",)}),
32+
)
33+
34+
inlines = [SpeakerSocialInline, SpeakerPresentationInline]
35+
36+
37+
@admin.register(SpeakerSocial)
38+
class SpeakerSocialAdmin(admin.ModelAdmin):
39+
list_display = ("speaker", "platform", "username", "url")
40+
list_filter = ("platform", "created_at")
41+
search_fields = ("speaker__first_name", "speaker__last_name", "platform", "username")
42+
readonly_fields = ("created_at", "updated_at")
43+
44+
45+
@admin.register(SpeakerPresentation)
46+
class SpeakerPresentationAdmin(admin.ModelAdmin):
47+
list_display = ("title", "speaker", "presentation_type", "created_at")
48+
list_filter = ("presentation_type", "created_at", "updated_at")
49+
search_fields = ("title", "speaker__first_name", "speaker__last_name", "description")
50+
readonly_fields = ("created_at", "updated_at")
51+
52+
fieldsets = (
53+
("Presentation Details", {"fields": ("title", "speaker", "presentation_type")}),
54+
("Content", {"fields": ("description", "abstract")}),
55+
("Timestamps", {"fields": ("created_at", "updated_at"), "classes": ("collapse",)}),
56+
)
57+
58+
59+
@admin.register(SpeakerSchedule)
60+
class SpeakerScheduleAdmin(admin.ModelAdmin):
61+
list_display = ("presentation", "speaker", "day", "track", "time_start", "time_end", "location")
62+
list_filter = ("day", "track", "time_start", "created_at")
63+
search_fields = ("presentation__title", "speaker__first_name", "speaker__last_name", "location")
64+
readonly_fields = ("created_at", "updated_at")
65+
66+
fieldsets = (
67+
("Schedule Details", {"fields": ("presentation", "speaker", "day", "track")}),
68+
("Timing & Location", {"fields": ("time_start", "time_end", "location")}),
69+
("Additional Information", {"fields": ("description",)}),
70+
("Timestamps", {"fields": ("created_at", "updated_at"), "classes": ("collapse",)}),
71+
)

app/sponsors/admin.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
11
from django.contrib import admin
22

3-
# Register your models here.
3+
from app.sponsors.models import Sponsor
4+
5+
6+
@admin.register(Sponsor)
7+
class SponsorAdmin(admin.ModelAdmin):
8+
list_display = ["name", "sponsor_type", "contact_name", "contact_email", "sponsorship_date", "created_at"]
9+
list_filter = ["sponsor_type", "sponsorship_date", "created_at"]
10+
search_fields = ["name", "contact_name", "contact_email", "info"]
11+
list_editable = ["sponsor_type"]
12+
ordering = ["sponsor_type", "name"]
13+
readonly_fields = ["created_at", "updated_at"]
14+
15+
fieldsets = (
16+
("Basic Information", {"fields": ("name", "sponsor_type", "info")}),
17+
("Media & Links", {"fields": ("logo_url", "website_url")}),
18+
("Contact Information", {"fields": ("contact_name", "contact_email")}),
19+
("Dates", {"fields": ("sponsorship_date", "created_at", "updated_at")}),
20+
)

0 commit comments

Comments
 (0)