On 5/11/2009 4:04 AM, Lior wrote: > Hello, > I'm using generic views to manage a model. In that model, when I > create an instance (and not when I update it), I need to set one of > its attribute (owner) to the currently logged in user value. I'd like > to continue using generic views, so can I do this without creating a > view? Is that possible? > The only solution, so far would be to create a new view (and in that > view do all what the generic view do, that is testing form fields, > etc.), and set my attribute from the request.user variable. But I > don't see how to keep the generic view usage in url.py. > > Any other way ?
You can easily use the generic view in your own view. It's a pretty common pattern in Django. In this case, you probably just want to pass the user as a extra context variable to be rendered as a hidden for your form. -- George --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---