Re: Re: Re: More complex QuerySets and generic views

2006-08-15 Thread Jon Atkinson
> You're using a variable "feedtype" that's not defined. > > It's the same thing as doing this in the Python interactive prompt: > > print a + 1 > > The variable "a" is not defined yet, so Python raises a NameError. > > The problem in your case is that your view won't know the value of >

Re: Re: Re: More complex QuerySets and generic views

2006-08-15 Thread Jon Atkinson
> > I think it's worth raising a feature request in the Django Trac for > this functionality. I can imagine that this would be very useful to a > lot of people in the future. > > Michael Done! http://code.djangoproject.com/ticket/2544 --Jon

Re: Re: More complex QuerySets and generic views

2006-08-15 Thread Adrian Holovaty
On 8/15/06, Jon Atkinson <[EMAIL PROTECTED]> wrote: > (r'^/?(?P\w+)/$', > 'django.views.generic.list_detail.object_list', {'queryset': > Item.objects.filter(feed__feedtype__feedtype__iexact=feedtype).order_by('-time'), > 'paginate_by': 15, 'extra_context': {'is_first_page': True}}), > > And oddly

Re: Re: More complex QuerySets and generic views

2006-08-15 Thread Michael van der Westhuizen
Hi Jon, On 8/15/06, Jon Atkinson <[EMAIL PROTECTED]> wrote: [snip] > I've just tried removing the regular expression - so the line looks like: > > (r'^/?(?P\w+)/$', > 'django.views.generic.list_detail.object_list', {'queryset': >

Re: Re: More complex QuerySets and generic views

2006-08-15 Thread Jon Atkinson
On 15/08/06, Michael van der Westhuizen <[EMAIL PROTECTED]> wrote: > > Do you really need the RE in the query? I think the problem is that > the re call is being evaluated immediately, which the query is lazily > evaluated. Would the "iexact" not work without the regular expression? > > If you do

Re: More complex QuerySets and generic views

2006-08-15 Thread Michael van der Westhuizen
Hi Jon, On 8/15/06, Jon Atkinson <[EMAIL PROTECTED]> wrote: > > 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

Re: More complex QuerySets and generic views

2006-08-15 Thread Chris Long
You could simplify your urls.py by extending the generic view with another view, e.g. an example from the authorization document: from django.views.generic.date_based import object_detail @login_required def limited_object_detail(*args, **kwargs): return object_detail(*args, **kwargs) It

More complex QuerySets and generic views

2006-08-15 Thread Jon Atkinson
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: