mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-06-21 03:58:26 +02:00
Address, responsible and phone number were missing. Use Google Maps API to query the address, to ensure to have valid addresses
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
# Copyright (C) 2020 by Animath
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from address.forms import AddressField
|
||||
from address.widgets import AddressWidget
|
||||
from django import forms
|
||||
from django.contrib.auth.forms import UserCreationForm
|
||||
from django.contrib.auth.models import User
|
||||
@ -67,7 +68,8 @@ class StudentRegistrationForm(forms.ModelForm):
|
||||
"""
|
||||
class Meta:
|
||||
model = StudentRegistration
|
||||
fields = ('team', 'student_class', 'school', 'give_contact_to_animath', 'email_confirmed',)
|
||||
fields = ('team', 'student_class', 'birth_date', 'address', 'phone_number',
|
||||
'school', 'give_contact_to_animath', 'email_confirmed',)
|
||||
|
||||
|
||||
class PhotoAuthorizationForm(forms.ModelForm):
|
||||
@ -98,7 +100,8 @@ class CoachRegistrationForm(forms.ModelForm):
|
||||
"""
|
||||
class Meta:
|
||||
model = CoachRegistration
|
||||
fields = ('team', 'professional_activity', 'give_contact_to_animath', 'email_confirmed',)
|
||||
fields = ('team', 'birth_date', 'address', 'phone_number', 'professional_activity',
|
||||
'give_contact_to_animath', 'email_confirmed',)
|
||||
|
||||
|
||||
class VolunteerRegistrationForm(forms.ModelForm):
|
||||
|
48
apps/registration/migrations/0002_auto_20201228_2219.py
Normal file
48
apps/registration/migrations/0002_auto_20201228_2219.py
Normal file
@ -0,0 +1,48 @@
|
||||
# Generated by Django 3.0.11 on 2020-12-28 21:19
|
||||
|
||||
import address.models
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import django.utils.timezone
|
||||
import phonenumber_field.modelfields
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('address', '0003_auto_20200830_1851'),
|
||||
('registration', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='participantregistration',
|
||||
name='address',
|
||||
field=address.models.AddressField(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, to='address.Address', verbose_name='address'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='participantregistration',
|
||||
name='birth_date',
|
||||
field=models.DateField(default=django.utils.timezone.now, verbose_name='birth date'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='participantregistration',
|
||||
name='phone_number',
|
||||
field=phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, region=None, verbose_name='phone number'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='studentregistration',
|
||||
name='responsible_email',
|
||||
field=models.EmailField(default='', max_length=254, verbose_name='responsible email address'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='studentregistration',
|
||||
name='responsible_name',
|
||||
field=models.CharField(default='', max_length=255, verbose_name='responsible name'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='studentregistration',
|
||||
name='responsible_phone',
|
||||
field=phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, region=None, verbose_name='responsible phone number'),
|
||||
),
|
||||
]
|
@ -1,14 +1,17 @@
|
||||
# Copyright (C) 2020 by Animath
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from address.models import AddressField
|
||||
from django.contrib.sites.models import Site
|
||||
from django.db import models
|
||||
from django.template import loader
|
||||
from django.urls import reverse_lazy
|
||||
from django.utils import timezone
|
||||
from django.utils.crypto import get_random_string
|
||||
from django.utils.encoding import force_bytes
|
||||
from django.utils.http import urlsafe_base64_encode
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from phonenumber_field.modelfields import PhoneNumberField
|
||||
from polymorphic.models import PolymorphicModel
|
||||
from tfjm.tokens import email_validation_token
|
||||
|
||||
@ -114,6 +117,22 @@ class ParticipantRegistration(Registration):
|
||||
verbose_name=_("team"),
|
||||
)
|
||||
|
||||
birth_date = models.DateField(
|
||||
verbose_name=_("birth date"),
|
||||
default=timezone.now,
|
||||
)
|
||||
|
||||
address = AddressField(
|
||||
verbose_name=_("address"),
|
||||
null=True,
|
||||
default=None,
|
||||
)
|
||||
|
||||
phone_number = PhoneNumberField(
|
||||
verbose_name=_("phone number"),
|
||||
blank=True,
|
||||
)
|
||||
|
||||
photo_authorization = models.FileField(
|
||||
verbose_name=_("photo authorization"),
|
||||
upload_to=get_random_photo_filename,
|
||||
@ -156,6 +175,22 @@ class StudentRegistration(ParticipantRegistration):
|
||||
verbose_name=_("school"),
|
||||
)
|
||||
|
||||
responsible_name = models.CharField(
|
||||
max_length=255,
|
||||
verbose_name=_("responsible name"),
|
||||
default="",
|
||||
)
|
||||
|
||||
responsible_phone = PhoneNumberField(
|
||||
verbose_name=_("responsible phone number"),
|
||||
blank=True,
|
||||
)
|
||||
|
||||
responsible_email = models.EmailField(
|
||||
verbose_name=_("responsible email address"),
|
||||
default="",
|
||||
)
|
||||
|
||||
parental_authorization = models.FileField(
|
||||
verbose_name=_("parental authorization"),
|
||||
upload_to=get_random_parental_filename,
|
||||
|
@ -4,6 +4,10 @@
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Sign up" %}{% endblock %}
|
||||
|
||||
{% block extracss %}
|
||||
{{ student_registration_form.media }}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h2>{% trans "Sign up" %}</h2>
|
||||
|
||||
|
@ -2,6 +2,10 @@
|
||||
|
||||
{% load crispy_forms_filters i18n %}
|
||||
|
||||
{% block extracss %}
|
||||
{{ registration_form.media }}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<form method="post">
|
||||
<div id="form-content">
|
||||
|
Reference in New Issue
Block a user