arneb / django-generic-confirmation

A generic change confirmation app for Django
BSD 3-Clause "New" or "Revised" License
20 stars 11 forks source link

Move logic to view level instead forms #2

Open jarus opened 10 years ago

jarus commented 10 years ago

Hi,

maybe it would be useful to move the logic from the form into views for example with a class-based-view mixin. This would allow to use the request object to build full urls etc. How do you feel about this?

arneb commented 10 years ago

Providing mixins for CBVs generally sounds like a good idea, but ...

I'll have to think a bit more about this whole idea, because having all the logic at the form makes it possibible to use the DeferedForms in other apps, without modifying the apps. For example: You can use one these forms in the Django Admin. Moving the logic into View-Mixins means a lot of modifications for all applications, which are not CBV based ...

Can the construction of fully qualified urls be solved with: Site.objects.get_current_site()?

Maybe the form save() method should accept kwargs and pass them to the notification method/handler, so that you can decide to pass a request object into it and have access to it during notification construction?