Opened 4 years ago

Closed 4 years ago

#16016 closed New feature (duplicate)

There should be a way to perform operations once the admin is done with a form

Reported by: info.ksamuel@… Owned by: nobody
Component: contrib.admin Version: 1.3
Severity: Normal Keywords: m2m admin
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX:

Description

Currently, adding m2m relationships programatically on a model save() is tricky if you want to use the admin: the admin calls save_m2m that clear the relationship and don't let you to hook something easily after that.

You can see the problem here:

http://stackoverflow.com/questions/4432385/django-how-to-save-m2m-data-via-post-save-signal

And here as well, with a workaround:

http://stackoverflow.com/questions/3652585/simple-django-form-model-save-question

Some kind of after_form_save signal would be great for this situation.

Change History (4)

comment:1 Changed 4 years ago by julien

  • Component changed from Uncategorized to contrib.admin
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Wouldn't it be an easier and cleaner work-around to alter the form's values from inside the ModelAdmin.save_model() hook?

comment:2 Changed 4 years ago by jezdez

  • Summary changed from There should be a way to perform operations once the admin si done with a form to There should be a way to perform operations once the admin is done with a form

comment:3 Changed 4 years ago by julien

Closing this as a duplicate of #16115 which, although newer, formulates the feature a bit more clearly and has a patch.

comment:4 Changed 4 years ago by julien

  • Resolution set to duplicate
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.
Back to Top