mirror of
https://github.com/Rushilwiz/launchx.git
synced 2025-04-05 12:40:18 -04:00
fix: fixed signup datafill glitch
This commit is contained in:
parent
0725c84f02
commit
f279e51724
|
@ -21,10 +21,10 @@ class CompetitorForm(forms.ModelForm):
|
||||||
CompetitorFormset = modelformset_factory(
|
CompetitorFormset = modelformset_factory(
|
||||||
Competitor,
|
Competitor,
|
||||||
form=CompetitorForm,
|
form=CompetitorForm,
|
||||||
min_num=2, max_num=4, extra=0)
|
min_num=2, max_num=4)
|
||||||
|
|
||||||
class TeamForm(forms.ModelForm):
|
class TeamForm(forms.ModelForm):
|
||||||
name = forms.CharField(required=False, label="Team Name (Optional)", widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'BusinessX'}))
|
name = forms.CharField(required=False, label="Team Name", widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'BusinessX'}))
|
||||||
reciept = forms.FileField(required=False)
|
reciept = forms.FileField(required=False)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
|
@ -13,7 +13,7 @@ def home(request):
|
||||||
return render(request, 'innovate/index.html')
|
return render(request, 'innovate/index.html')
|
||||||
|
|
||||||
def signup(request):
|
def signup(request):
|
||||||
formset = CompetitorFormset()
|
formset = CompetitorFormset(queryset=Competitor.objects.none())
|
||||||
team_form = TeamForm()
|
team_form = TeamForm()
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
|
@ -30,10 +30,11 @@ def signup(request):
|
||||||
county = form.cleaned_data.get('school')
|
county = form.cleaned_data.get('school')
|
||||||
if name and email and school and county:
|
if name and email and school and county:
|
||||||
m = Competitor(name=name, email=email, school=school, county=county, is_leader=is_leader, team=team)
|
m = Competitor(name=name, email=email, school=school, county=county, is_leader=is_leader, team=team)
|
||||||
m.save()
|
|
||||||
is_leader = False
|
is_leader = False
|
||||||
members.append(m)
|
members.append(m)
|
||||||
send_confirmation(request, team,members)
|
send_confirmation(request, team, members)
|
||||||
|
for m in members:
|
||||||
|
m.save()
|
||||||
return redirect('landing')
|
return redirect('landing')
|
||||||
|
|
||||||
return render(request, 'innovate/signup.html', {'formset': formset, 'team_form': team_form})
|
return render(request, 'innovate/signup.html', {'formset': formset, 'team_form': team_form})
|
||||||
|
|
Loading…
Reference in New Issue
Block a user