> > That's fine for one or two models. But what if I want to do this for a
> > number of models, in every view? What's the best way to do that
> > without code repetition?
>
> Using a ModelForm?
>
> http://docs.djangoproject.com/en/dev/topics/forms/modelforms/
Ok, I think I understand now. ModelFo
> Presumably you have a view which is updating this object. The view has
> access to the HttpRequest. Therefore, the easy, simple, clean and
> elegant way is... to have the view set the value of that field. So do
> that and ignore anyone who tells you otherwise --
> magically/secretly/implicitly t
I'm trying to find the best way to update a model using data from the
request object (e.g request.user) before it is saved. One use case for
this is updating an 'updated_by' field on a model.
I've come across http://www.djangosnippets.org/snippets/476/ which
suggests one way of doing this. What do
3 matches
Mail list logo