S
S
SilentSokolov2013-02-02 09:43:46
Django
SilentSokolov, 2013-02-02 09:43:46

Save object immediately when adding via admin panel?

I ran into a problem: you need to save the model object immediately after the user goes to the /add/ page in the admin panel. That is, so that it already has a primary key (committing to the database is not critical).
Roughly speaking, I need object_id and content_type_id, which in the standard implementation are available only when "editing" an object, and not when adding it.
Tried to do it via post_init signal, but for some unknown reason it creates multiple objects, not just one.
Ideas?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alz, 2013-02-02
@alz

Override the form for ModelAdmin

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question