On Fri, 2006-07-21 at 01:16 -0700, Steve Wedig wrote: > Hello, > > This may be a rudimentary question, sorry if is... > > I would like to use the generic create_object view, but populate a > hidden form field with a location_id argument which is extracted from > the url. I've tried this url pattern below, but get this error: > create_object() got an unexpected keyword argument 'location_id' > > This error seems to make sense. I've tried to somehow get location_id > into extra_context argument somehow, but I can't get it to work. Is > this task possible while still taking advantage of the generic view? > > in urls.py... > > (r'^create/(?P<location_id>\d+)/$', > 'django.views.generic.create_update.create_object', > {'model':Conversation),
If you want to pass extra information into a generic view that requires some processing (as in this case), write a little view of your own that does the processing and then passes off handling to the generic view: def steves_update(request, model, location_id): return create_object(model = model, extra_context = {'location_id': location_id}) You'll need to import Conversation and the create_object() function here, but then just call it as you have above (replace the 'django.views....' line with the path to your view function). Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---