Hi,

I'm dabbling with generic views (thanks to wise advice from others on
this list), and I'm trying to convert one of my slightly more
complicated views to use a generic view. The vie itself is a simple
list, but my queryset is generated as follows:

Item.objects.filter(feed__feedtype__feedtype__iexact=re.sub('(s$|S$)',
'', feedtype)).order_by('-time')

What I'm trying to achieve here is not locking users into a certain
URL scheme - for the feedtype, I want uses to be able to specify
'/link', '/links', '/LINKS', and any combination thereof, hence the
regular expression which removes the trailing 's' from the request and
performs the case-insensitive query. This works fine when I use it in
a traditional view.

Now that I'm trying to use generic views (to avoid doing some ugly
pagination by hand), my urls.py line is as follows:

(r'^/?(?P<feedtype>\w+)/$',
'django.views.generic.list_detail.object_list', {'queryset':
Item.objects.filter(feed__feedtype__feedtype__iexact=re.sub('(s$|S$)',
'', feedtype)).order_by('-time'), 'paginate_by': 15, 'extra_context':
{'is_first_page': True}}),

However, the error which I get is as follows:

NameError at /photo/
name 'feedtype' is not defined
Request Method: GET
Request URL:    http://localhost:8000/photo/
Exception Type: NameError
Exception Value:        name 'feedtype' is not defined

I'm guessing that this is being caused by the regular expression
evaluation not seeing that 'feedtype' exists - is there a way to solve
this or will I have to use a standard view for this particular action?

--Jon

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to