25 lines
No EOL
860 B
Python
25 lines
No EOL
860 B
Python
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) |