adding gamechanger, in progress
This commit is contained in:
35
gamechanger/forms.py
Normal file
35
gamechanger/forms.py
Normal file
@@ -0,0 +1,35 @@
|
||||
from django import forms
|
||||
from django.forms import ModelForm, formset_factory
|
||||
|
||||
from .models import Preferences, Account, Player
|
||||
|
||||
class PreferencesForm(ModelForm):
|
||||
class Meta:
|
||||
model = Preferences
|
||||
fields = ["user", "season_id", "team_id"]
|
||||
widgets = {
|
||||
"user": forms.HiddenInput(),
|
||||
"managed_team_id": forms.TextInput(),
|
||||
}
|
||||
labels = {"managed_team_id": "Selected Team"}
|
||||
|
||||
class AccountForm(ModelForm):
|
||||
class Meta:
|
||||
model = Account
|
||||
fields = ["user", "email", "password"]
|
||||
widgets = {
|
||||
"user": forms.HiddenInput(),
|
||||
"email": forms.EmailInput(),
|
||||
"password": forms.PasswordInput()
|
||||
}
|
||||
|
||||
class PlayerForm(ModelForm):
|
||||
gamechanger_name = forms.Field()
|
||||
teamsnap_name = forms.Field()
|
||||
gamechanger_id = forms.Field()
|
||||
|
||||
class Meta:
|
||||
model = Player
|
||||
fields = ['id', 'teamsnap_member_id']
|
||||
|
||||
PlayerFormSet = formset_factory(PlayerForm, can_delete=True, extra=0)
|
||||
Reference in New Issue
Block a user