views:

123

answers:

1

I want to ensure that a user editing a particular model is saved in that models updated_by (FK User) field.

I'm using mostly ModelForms (not necessarily the built in Admin), and wondering:

In what cases would I need to override ModelAdmin.save_model() or ModelAdmin.save_formset()?

Or, is that doing it wrong? If it's just the models' save() method that needs to be overridden, is there a proper way to access the request object there?

A: 

This was previously answer by Daniel Roseman over here.

If you want something that will work both in the admin and elsewhere, you should use a custom modelform.

He provides an example and points to this blog post by James Bennett.

anonymous coward