JourneyJoker/localauth/forms.py

25 lines
860 B
Python
Raw Permalink Normal View History

from django.contrib.auth.forms import UserCreationForm
2021-03-23 18:23:04 +00:00
from django import forms
from .models import User
2021-03-23 18:23:04 +00:00
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
2021-03-23 18:23:04 +00:00
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)