Задать вопрос

Тел: +7 965 3737 888

495

Просмотров

1

Ответов

ModelForm-based create_update generic views

This is a ModelForms-based rewrite of the create_object and update_object generic views, with a few added features. The views now accept a "form_class" argument optionally in place of the "model" argument, so you can create and tweak your own ModelForm to pass in. They also accept a "pre_save" callback that can make any additional changes to the created or updated instance (based on request.user, for instance) before it is saved to the DB.

Usage: just save the code in a file anywhere on the PythonPath and use the create_object and update_object functions as views in your urls.py.

Вопрос полезен? Да0/Нет0
file_5191.py(5.2Кб)
None

Ответы (1):

Ответcarljm:18.07.2008
Ответ полезен? Да0/Нет0

And... it was checked in to trunk today. Never mind this snippet.