Commit ad4904b2 authored by Jan Ericsson Ong Ang's avatar Jan Ericsson Ong Ang

changed tabular inline to stacked inline and added reference link comment

parent e154029f
from django.contrib import admin from django.contrib import admin
from .models import Event, Location from .models import Event, Location
class EventInline(admin.TabularInline): class LocationInline(admin.StackedInline):
model = Event model = Location
class LocationAdmin(admin.ModelAdmin): class LocationAdmin(admin.ModelAdmin):
model = Location model = Location
...@@ -14,7 +14,10 @@ class EventAdmin(admin.ModelAdmin): ...@@ -14,7 +14,10 @@ class EventAdmin(admin.ModelAdmin):
model = Event model = Event
list_display = ("target_datetime", "activity", "estimated_hours", "course", "location",) list_display = ("target_datetime", "activity", "estimated_hours", "course", "location",)
search_fields = ("activity", "course", "location",) search_fields = ("activity", "course", "location",)
inlines = [LocationInline,]
admin.site.register(Event, EventAdmin) admin.site.register(Event, EventAdmin)
admin.site.register(Location, LocationAdmin) admin.site.register(Location, LocationAdmin)
#reference: https://stackoverflow.com/questions/4890981/django-admin-stackedinline-customisation
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment