Private
Public Access
1
0

simple upgrade/billing address form

This commit is contained in:
Sander Roosendaal
2018-12-19 10:33:43 +01:00
parent 0b79b0de98
commit fa61957be7
8 changed files with 126 additions and 7 deletions

View File

@@ -2,7 +2,8 @@ from django import forms
from django.contrib.admin.widgets import FilteredSelectMultiple
from rowers.models import (
Workout,Rower,Team,PlannedSession,GeoCourse,
VirtualRace,VirtualRaceResult,IndoorVirtualRaceResult
VirtualRace,VirtualRaceResult,IndoorVirtualRaceResult,
PaidPlan
)
from rowers.rows import validate_file_extension,must_be_csv,validate_image_extension,validate_kml
from django.contrib.auth.forms import UserCreationForm
@@ -712,7 +713,19 @@ class StatsOptionsForm(forms.Form):
for type in mytypes.checktypes:
self.fields[type] = forms.BooleanField(initial=True,required=False)
class PlanSelectForm(forms.Form):
plan = forms.ModelChoiceField(queryset=PaidPlan.objects.all(),
widget=forms.RadioSelect,required=True)
def __init__(self, *args, **kwargs):
paymentprocessor = kwargs.pop('paymentprocessor',None)
super(PlanSelectForm, self).__init__(*args, **kwargs)
self.fields['plan'].empty_label = None
if paymentprocessor:
self.fields['plan'].queryset = PaidPlan.objects.filter(
paymentprocessor=paymentprocessor
).exclude(shortname="basic").order_by("price","clubsize","shortname")
class CourseSelectForm(forms.Form):
course = forms.ModelChoiceField(queryset=GeoCourse.objects.all())