do it like this: return object_list( request, **CATEGORY_DETAIL ) read about this: http://docs.python.org/tut/node6.html#SECTION006720000000000000000
concrete for this example: >>> def parrot(voltage, state='a stiff', action='voom'): ... print "-- This parrot wouldn't", action, ... print "if you put", voltage, "volts through it.", ... print "E's", state, "!" ... >>> d = {"voltage": "four million", "state": "bleedin' demised", "action": >>> "VOOM"} >>> parrot(**d) -- This parrot wouldn't VOOM if you put four million volts through it. E's bleedin' demised ! On Jan 15, 7:55 am, Chris <[EMAIL PROTECTED]> wrote: > Thanks so much for your help. Can I pass in the whole dictionary as > you do in your example? When I attempt to do that I get this error. > dict' object has no attribute '_clone'. Alternatively I can simpley > pass in the individual variables suchas queryset and it works. I would > like to pass it in as a dictionary if at all possible. > > Thanks again. > > On Jan 14, 5:13 pm, Alex Koshelev <[EMAIL PROTECTED]> wrote: > > > If you want to apply additional filtering for query set with parameter > > that has catched from url so you have to "inherit" generic view with > > your own. Example for your case: > > > #views.py > > from django.views.generic.list_detail import object_list > > > def my_view( request, tag_category ): > > CATEGORY_DETAIL = { > > 'queryset': > > Article.objects.filter(tag__tag_name__iexact=tag_category), > > 'paginate_by':15, > > } > > return object_list( request, CATEGORY_DETAIL ) > > > #urls.py > > urlpatterns = patterns('', > > (r'^category/(?P<tag_category>[-\w]+)/$', > > 'my_app.views.my_view' ), ) > > > With proper names of course > > > On 14 янв, 22:44, Chris <[EMAIL PROTECTED]> wrote: > > > > I still get that error. Just forgot to add in the details variable > > > when I dpasted.http://dpaste.com/31049/butIstill get the same > > > error that I was talking about. Should I put the details dictionary > > > definition below the urlpattern so that maybe the variable is defined > > > before I get to that point in my code? I don't have 'request' to work > > > with as I do when defining my own view so for some reason I can't seem > > > to call directly and can't seem to find the proper accessor to grab > > > the tag_catagory value from the expression. > > > > Any other suggestions as to why it is not working? > > > > On Jan 14, 12:30 pm, Alex Koshelev <[EMAIL PROTECTED]> wrote: > > > > > You must specify details in pattern > > > > definitianhttp://www.djangoproject.com/documentation/generic_views/ > > > > > On 14 янв, 20:08, Chris <[EMAIL PROTECTED]> wrote: > > > > > > Hello I am working with a generic view and I am trying to grab the url > > > > > expression variable and pass it to a dictionary for the generic view > > > > > to use but I keep getting an error that the variable is not defined. > > > > > Its obvious that the variable is not defined yet but is there a way > > > > > that I can make this work? Here is an example that I have. Worst case > > > > > scenario is that I create my own view which I already have but I like > > > > > to use what is already provided. Anyone have a work around to my > > > > > generic views problem? > > > > > > Here is the code:http://dpaste.com/31029/ > > > > > > Thanks ahead of time. --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---