generic views + new admin templates
stava wrote:
> I'm trying to use generic views together with the newly separated admin
> templates, but it's failing miserably.
>
> I specify the generic view I want to use in url.py:
> countries = {
> 'app_label': 'ttime',
> 'module_name': 'countries',
> }
> urlpatterns = patterns('',
> (r'^countries/$',
> 'django.views.generic.list_detail.object_list', countries),
> (r'^countries/add/$',
> 'django.views.generic.create_update.create_object', countries),
> )
>
> I've copied django/contrib/admin/templates/admin/change_list.html to my
> own template directory (no changes yet).
>
> All I get for my efforts is:
> AttributeError at /countries/
> 'str' object has no attribute 'result_count'
> Request Method: GET
> Request URL:http://localhost:8000/countries/> Exception Type: AttributeError
> Exception Value: 'str' object has no attribute 'result_count'
> Exception Location:
>
> /usr/lib/python2.4/site-packages/django/contrib/admin/templatetags/admin_list.py
> in search_form, line 264
>
> And the (nice and pretty but still) error message points to the line
> containing the {% search_form cl %} tag.
>
> I must be missing something fundamental here.
>
> Anyone?
>
> /LarS
>
>
Erm, the generic views do not provide a reasonable context for the
changelist.
If you want to make something like the changelist in the admin, you
should probably start off with a copy of the view function from the admin.