Django Class Based Views Cheat Sheet

A Programming › Python cheat sheet in English by papousekp

Django Class Based Views

34,548 views 8,058 downloads 15 Apr 2013 History
4.9 avg · 2 ratings

Multip­leO­bje­ctM­ixi­n(o­bject)

allow_­empty
True
queryset
None
model
None
pagina­te_by
None
contex­t_o­bje­ct_name
None "­%(m­ode­l_n­ame­)s_­lis­t"
pagina­tor­_class
Paginator
 
get_qu­eryset()
queryset
pagina­te_­que­ryset(self, queryset, page_size)
tuple
get_pa­gin­ate_by(queryset)
int or None
get_pa­ginator(self, queryset, per_page, orphans=0, allow_­emp­ty_­fir­st_­pag­e=True)
get_al­low­_empty()
bool
get_co­nte­xt_­obj­ect­_name(self, object­_list)
string or None
get_co­nte­xt_data(self, **kwargs)
dict

BaseLi­stV­iew­(Mu­lti­ple­Obj­ect­Mixin, View)

get(self, request, args, *kwargs)

Multip­leO­bje­ctT­emp­lat­eRe­spo­nse­Mixin

subcla­ssing (Templa­teR­esp­ons­eMixin)
templa­te_­nam­e_s­uffix
'­_li­st'
get_te­mpl­ate­_names(self)
list

ListView

(Multip­leO­bje­ctT­emp­lat­eRe­spo­nse­Mixin, BaseLi­stView)

Admin list custom fields

custom­_field(obj)
.allow­_tags
handy for links (bool)
.short­_de­scr­iption
string
.admin­_or­der­_field
field name (string)

Badges

Nice Cheat Sheet Good Cheat Sheet Downloaded from Unusual Locations × 5

Comments

No comments yet.

Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.