asifpy / django-crudbuilder

Generic CRUD implementation in Django
https://django-crudbuilder.readthedocs.org/en/latest/index.html
Apache License 2.0
193 stars 67 forks source link

Added support for custom CreateViews and UpdateViews #61

Closed tonimichel closed 6 years ago

tonimichel commented 6 years ago

Hi asifpy,

first of all thanks for the awesome crudbuilder. I really like it and I am heavily using it.

I added a few lines of code that allow to customize the generated Update and Create Views by mixins. My concrete challenge was to add a custom get_success_url for Create and Update. However I did not want to write a custom view in a custom module and add it to the urls.py.

Instead I found it useful to just add a custom mixin for the create and update view:

https://gist.github.com/tonimichel/d2e96f6a20a8028ba5c5ab7c49a3ab02

We now can overwrite any class attribute and easily customize the generated view functions. Of course we could also extends this principle to the detail, list and delete view.

Let me know if you like it.

Best regards from Stuttgart, Germany. Toni

coveralls commented 6 years ago

Coverage Status

Coverage decreased (-0.05%) to 79.319% when pulling a9158b6c90e64129c306c23e63d0516f630f647b on tonimichel:master into 8e484108943feb607415823de8c65b97eb4b3cef on asifpy:master.