JourneyJoker/localauth/forms.py

25 lines
No EOL
860 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from django.contrib.auth.forms import UserCreationForm
from django import forms
from .models import User
from partners.models import PartnerProfile
from clients.models import ClientProfile
class RegistrationForm(UserCreationForm):
def __init__(self, *args, **kwargs):
kwargs.pop("request")
super().__init__(*args, **kwargs)
class Meta:
model = User
fields = ["email", "password1", "password2"]
class VerificationForm(forms.Form):
def get_choices():
for client in ClientProfile.objects.filter(verified=False):
yield ("C%i" % client.id, "C%i %s" % (client.id, client.full_name))
for partner in PartnerProfile.objects.filter(verified=False):
yield ("P%i" % partner.id, "P%i %s" % (partner.id, partner.full_name))
profile = forms.ChoiceField(choices=get_choices)