blob: f94a34db472b33476a386b0ec348e5584d9b9ec4 (
plain)
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 models import Event
class EventAdmin(admin.ModelAdmin):
list_display = ('name', 'start', 'end', 'source')
list_filter = ('source',)
search_fields = ['name', 'description']
date_hierachy = 'start'
def save_model(self, request, obj, form, change):
"""Sets the source to "admin".
"""
if not obj.id:
obj.source = Event.SOURCE_ADMIN
obj.save()
admin.site.register(Event, EventAdmin)
|