mirror of
https://github.com/Rushilwiz/launchx.git
synced 2025-04-05 04:30:19 -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(
|
||||
Competitor,
|
||||
form=CompetitorForm,
|
||||
min_num=2, max_num=4, extra=0)
|
||||
min_num=2, max_num=4)
|
||||
|
||||
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)
|
||||
|
||||
class Meta:
|
||||
|
|
|
@ -13,7 +13,7 @@ def home(request):
|
|||
return render(request, 'innovate/index.html')
|
||||
|
||||
def signup(request):
|
||||
formset = CompetitorFormset()
|
||||
formset = CompetitorFormset(queryset=Competitor.objects.none())
|
||||
team_form = TeamForm()
|
||||
|
||||
if request.method == 'POST':
|
||||
|
@ -30,10 +30,11 @@ def signup(request):
|
|||
county = form.cleaned_data.get('school')
|
||||
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.save()
|
||||
is_leader = False
|
||||
members.append(m)
|
||||
send_confirmation(request, team,members)
|
||||
send_confirmation(request, team, members)
|
||||
for m in members:
|
||||
m.save()
|
||||
return redirect('landing')
|
||||
|
||||
return render(request, 'innovate/signup.html', {'formset': formset, 'team_form': team_form})
|
||||
|
|
Loading…
Reference in New Issue
Block a user