def list(request: HttpRequest) -> HttpResponse: teams = Team.objects_ordered_by_remaining_space().all() my_team_ids = [team.id for team in request.user.teams.all()] return render(request, 'team/list.html', context={ 'profile': request.user.profile, 'my_team_ids': my_team_ids, 'teams': teams, })
class SignUpForm(forms.Form): first_name = forms.CharField(label="What's your first name, little dino?", max_length=30) last_name = forms.CharField(label="And your last name?", max_length=30) years_on_playa = forms.IntegerField( label= "Nice to meet you! So how many years have you gone to Burning Man?") interested_teams = forms.ModelMultipleChoiceField( label= 'Which teams are you interested in joining? (you can always change it later)', widget=forms.CheckboxSelectMultiple, queryset=Team.objects_ordered_by_remaining_space().filter( num_members__lt=F('max_size'))) invited_by = forms.CharField(label="Who invited you to LED Dinosaur?", max_length=64) email = forms.EmailField( label="Cool! What's your email so we can keep you up to date?") password = forms.CharField(label="And a password so we can identify you!", widget=forms.PasswordInput, min_length=8) duplicate_password = forms.CharField( label=" What was that password again? (in case you typo-ed)", widget=forms.PasswordInput, min_length=8) phone = forms.CharField(label="And your phone number, por favor?") zipcode = forms.CharField(label="Last one. What's your zip code?", max_length=5, min_length=5) captcha = ReCaptchaField(label='') def clean(self): super().clean() password = self.cleaned_data['password'] duplicate_password = self.cleaned_data['duplicate_password'] if password != duplicate_password: raise ValidationError('Passwords must match!') def clean_phone(self) -> str: return UserProfile.parse_phone_number(self.cleaned_data['phone'])