-
Notifications
You must be signed in to change notification settings - Fork 1
/
admin.py
20 lines (17 loc) · 806 Bytes
/
admin.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from django.contrib import admin
from django_events_timetable.models import Event, TimeTable
from django_events_timetable.forms import EventAdminForm, TimeTableAdminForm
@admin.register(Event)
class EventAdmin(admin.ModelAdmin):
form = EventAdminForm
list_display = ('id', 'name', 'start_date', 'shortcode_display')
list_filter = ('start_date',)
readonly_fields = ('shortcode_display',)
def shortcode_display(self, obj):
return obj.generate_shortcode()
shortcode_display.short_description = "Display Tag"
@admin.register(TimeTable)
class TimeTableAdmin(admin.ModelAdmin):
form = TimeTableAdminForm
list_display = ('item_event', 'start_time', 'end_time', 'created', 'title', 'description')
list_filter = ('item_event', 'start_time', 'end_time', 'title')