django-generic-confirmation icon indicating copy to clipboard operation
django-generic-confirmation copied to clipboard

Move logic to view level instead forms

Open jarus opened this issue 10 years ago • 1 comments

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?

jarus avatar Feb 23 '14 15:02 jarus

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?

arneb avatar Feb 24 '14 10:02 arneb