Changes between Version 70 and Version 71 of RemovingTheMagic


Ignore:
Timestamp:
02/25/06 11:41:24 (9 years ago)
Author:
chaoskcw
Comment:

Fixed Documentation on Generic Views and Querysets

Legend:

Unmodified
Added
Removed
Modified
  • RemovingTheMagic

    v70 v71  
    555555=== Changed the parameters you pass to generic views ===
    556556
    557 Because there's no longer a concept of {{{module_name}}}, the "info_dicts" passed to [http://www.djangoproject.com/documentation/generic_views/ generic views] no longer accept {{{"app_label"}}} and {{{"module_name"}}}. Instead, pass the parameter {{{"model"}}}, which should be your model class.
    558 
    559 These examples assume models live in {{{myproject/blog/models.py}}}.
    560 
    561 Old:
     557'''This has been made obsolete by QuerySets'''
     558----
     559~~Because there's no longer a concept of {{{module_name}}}, the "info_dicts" passed to [http://www.djangoproject.com/documentation/generic_views/ generic views] no longer accept {{{"app_label"}}} and {{{"module_name"}}}. Instead, pass the parameter {{{"model"}}}, which should be your model class.~~
     560
     561~~These examples assume models live in {{{myproject/blog/models.py}}}.~~
     562----
     563
     564'''Generic Views now use QuerySets instead of the 'model' argument'''
     565
     566Oldest:
    562567{{{
    563568#!python
     
    568573}}}
    569574
    570 New:
     575Older:
    571576{{{
    572577#!python
    573578from myproject.blog.models import Entry
    574579info_dict = {'model': Entry}
     580}}}
     581
     582New:
     583{{{
     584#!python
     585from myproject.blog.models import Entry
     586info_dict = {'queryset': Entry.objects}
     587
     588or
     589
     590urlpatterns = patterns('',
     591     (r'^(?P<object_id>\d+)/$', 'django.views.generic.list_detail.object_detail', {'queryset': Entry.objects})
     592)
    575593}}}
    576594
Back to Top