On 19 February 2010 10:27, Paul Stone wrote:
> > > 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/to
> > 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
On 19 February 2010 09:28, Paul Stone wrote:
>
> > 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
> 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
On 18/02/10 15:55, Paul Stone wrote:
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/sn/ippets/476 which
On Thu, Feb 18, 2010 at 10:55 AM, Paul Stone wrote:
> 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.
Presumably you have a view which is updating th
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
7 matches
Mail list logo