I am using django-registration
app. I've two registration form A
and B
. A
has default registration fields. And in B
I've added custom fields and a signal. Following signal also execute for both registration form. That's why I added if form.is_valid()
. and it sucks. I want to execute only when BForm
is called. Is there any alternative? Can anyone help me to improve this code? thanks
class BForm(RegistrationForm):
"""
Subclass of ``RegistrationForm``
"""
phone = forms.CharField(max_length=100, required=False)
Signal
def user_created(sender, user, request, **kwargs):
form = BForm(request.POST)
if form.is_valid():
.....
user_registered.connect(user_created)