class call in square brackets in django, python -
this snippet djangoproject.com tutorial. can explain why line written in way:
inlines =[choiceinline]
instead of
inlines = choiceinline
why there square brackets around class choiceinline?
from django.contrib import admin naslovnica.models import poll naslovnica.models import choice class choiceinline(admin.tabularinline): model = choice = 3 class polladmin(admin.modeladmin): fieldsets = [ (none, {'fields': ['question']}), ('date information', {'fields': ['pub_date'], 'classes': ['collapse']}), ] inlines =[choiceinline] list_display = ('question', 'pub_date', 'was_published_recently') search_fields = ['question'] list_filter = ['pub_date'] admin.site.register(poll, polladmin)
inlines =[choiceinline]
not calling of class. create new list has class
first element.
class calling done choiceinline()
.
Comments
Post a Comment