Created
August 23, 2018 00:39
-
-
Save robsonsilv4/3c656a04a57a1b6a3ebb0ebac2184840 to your computer and use it in GitHub Desktop.
Django override get_form on CreateView
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyModelAdd(CreateView): | |
model = MyModel | |
def get_form(self): | |
type_form = self.request.GET.get('type') | |
if type_form == 'pf': | |
self.form_class = PFForm | |
else: | |
self.form_class = PJForm | |
return super(MyModelAdd, self).get_form() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Lembrando que na url deve conter