Admin Panel List Display

This is some of part of file:

class BookingAdmin(admin.ModelAdmin):
list_display = [‘hall’, ‘event_name’, ‘name’, ‘date’, ‘start_time’, ‘end_time’, ’email’, ‘status’ ]
class Meta:
model = Booking, BookingAdmin)

In this file, there is a new ModelAdmin class named “BookingAdmin”. It is connected to the model “Booking” that we created in the file. Hence it did show the name of the hall only previously in the admin panel.

But we need all the details of the booking like name of event, time, date, which hall, organizer details etc. Then it will be easy for the admin to decide which booking to select. So the meaning of second line is this: it displays the fields accordingly as listed in the single quotes.

It will only take effect after we register by writing the last line. It registers the model Booking and module BookingAdmin together so that we can view model’s information in the admin panel UI.

Similarly I used the list_display method for Hall model to show the name of the hall and no. of seats when overviewing the list.




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this:
search previous next tag category expand menu location phone mail time cart zoom edit close