mirror of https://gitlab.crans.org/bde/nk20
Give Pikachu as an example
This commit is contained in:
parent
beff848796
commit
bba69f0a60
|
@ -41,6 +41,10 @@ class ProfileForm(forms.ModelForm):
|
||||||
|
|
||||||
last_report = forms.DateTimeField(required=False, disabled=True, label=_("Last report date"))
|
last_report = forms.DateTimeField(required=False, disabled=True, label=_("Last report date"))
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
self.fields['address'].widget.attrs.update({"placeholder": "4 avenue des Sciences, 91190 GIF-SUR-YVETTE"})
|
||||||
|
|
||||||
def save(self, commit=True):
|
def save(self, commit=True):
|
||||||
if not self.instance.section or (("department" in self.changed_data
|
if not self.instance.section or (("department" in self.changed_data
|
||||||
or "promotion" in self.changed_data) and "section" not in self.changed_data):
|
or "promotion" in self.changed_data) and "section" not in self.changed_data):
|
||||||
|
|
|
@ -22,6 +22,11 @@ class SignUpForm(UserCreationForm):
|
||||||
self.fields['email'].required = True
|
self.fields['email'].required = True
|
||||||
self.fields['email'].help_text = _("This address must be valid.")
|
self.fields['email'].help_text = _("This address must be valid.")
|
||||||
|
|
||||||
|
# Give some example
|
||||||
|
self.fields['first_name'].widget.attrs.update({"placeholder": "Sacha"})
|
||||||
|
self.fields['last_name'].widget.attrs.update({"placeholder": "Ketchum"})
|
||||||
|
self.fields['email'].widget.attrs.update({"placeholder": "mail@example.com"})
|
||||||
|
|
||||||
def clean_username(self):
|
def clean_username(self):
|
||||||
value = self.cleaned_data["username"]
|
value = self.cleaned_data["username"]
|
||||||
if Alias.objects.filter(normalized_name=Alias.normalize(value)).exists():
|
if Alias.objects.filter(normalized_name=Alias.normalize(value)).exists():
|
||||||
|
|
Loading…
Reference in New Issue