From ce35e8f7e822f17e4b49a009f314ecc7b37395d0 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Mon, 10 Aug 2020 11:40:51 +0200 Subject: [PATCH 1/4] Make the container customizable --- apps/registration/templates/registration/login.html | 3 +++ apps/registration/templates/registration/signup.html | 5 +++-- note_kfet/templates/base.html | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/apps/registration/templates/registration/login.html b/apps/registration/templates/registration/login.html index 7cdec5b3..d22203ef 100644 --- a/apps/registration/templates/registration/login.html +++ b/apps/registration/templates/registration/login.html @@ -4,6 +4,9 @@ SPDX-License-Identifier: GPL-2.0-or-later {% endcomment %} {% load i18n crispy_forms_tags static %} +{# Use a fixed-width container #} +{% block containertype %}container{% endblock %} + {# Change page title without displaying it in header #} {% block title %}{% trans "Log in" %}{% endblock %} {% block contenttitle %}{% endblock %} diff --git a/apps/registration/templates/registration/signup.html b/apps/registration/templates/registration/signup.html index 76f88a49..31134d73 100644 --- a/apps/registration/templates/registration/signup.html +++ b/apps/registration/templates/registration/signup.html @@ -4,9 +4,10 @@ {% load i18n %} {% block title %}{% trans "Sign up" %}{% endblock %} -{% block content %} -

{% trans "Sign up" %}

+{# Use a fixed-width container #} +{% block containertype %}container{% endblock %} +{% block content %}
{% blocktrans %}If you already signed up, your registration is taken into account. The BDE must validate your account before your can log in. You have to go to the Kfet and pay the registration fee. You must also validate your email address by following the link you received.{% endblocktrans %}
diff --git a/note_kfet/templates/base.html b/note_kfet/templates/base.html index e50defcb..461d9593 100644 --- a/note_kfet/templates/base.html +++ b/note_kfet/templates/base.html @@ -167,7 +167,7 @@ SPDX-License-Identifier: GPL-3.0-or-later -
+
{% if request.user.is_authenticated and not request.user.profile.email_confirmed %}
{% trans "Your e-mail address is not validated. Please check your mail inbox and click on the validation link." %} From e78ba492529117c0b87321ab92f8252c6619aa13 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Mon, 10 Aug 2020 12:08:21 +0200 Subject: [PATCH 2/4] Override Django Registration templates --- .../templates/registration/logged_out.html | 0 .../templates/registration/login.html | 3 --- .../templates/registration/password_change_done.html | 0 .../templates/registration/password_change_form.html | 0 .../templates/registration/password_reset_complete.html | 0 .../templates/registration/password_reset_confirm.html | 0 .../templates/registration/password_reset_done.html | 0 .../templates/registration/password_reset_form.html | 0 .../templates/registration/signup.html | 0 9 files changed, 3 deletions(-) rename {apps/registration => note_kfet}/templates/registration/logged_out.html (100%) rename {apps/registration => note_kfet}/templates/registration/login.html (95%) rename {apps/registration => note_kfet}/templates/registration/password_change_done.html (100%) rename {apps/registration => note_kfet}/templates/registration/password_change_form.html (100%) rename {apps/registration => note_kfet}/templates/registration/password_reset_complete.html (100%) rename {apps/registration => note_kfet}/templates/registration/password_reset_confirm.html (100%) rename {apps/registration => note_kfet}/templates/registration/password_reset_done.html (100%) rename {apps/registration => note_kfet}/templates/registration/password_reset_form.html (100%) rename {apps/registration => note_kfet}/templates/registration/signup.html (100%) diff --git a/apps/registration/templates/registration/logged_out.html b/note_kfet/templates/registration/logged_out.html similarity index 100% rename from apps/registration/templates/registration/logged_out.html rename to note_kfet/templates/registration/logged_out.html diff --git a/apps/registration/templates/registration/login.html b/note_kfet/templates/registration/login.html similarity index 95% rename from apps/registration/templates/registration/login.html rename to note_kfet/templates/registration/login.html index d22203ef..7cdec5b3 100644 --- a/apps/registration/templates/registration/login.html +++ b/note_kfet/templates/registration/login.html @@ -4,9 +4,6 @@ SPDX-License-Identifier: GPL-2.0-or-later {% endcomment %} {% load i18n crispy_forms_tags static %} -{# Use a fixed-width container #} -{% block containertype %}container{% endblock %} - {# Change page title without displaying it in header #} {% block title %}{% trans "Log in" %}{% endblock %} {% block contenttitle %}{% endblock %} diff --git a/apps/registration/templates/registration/password_change_done.html b/note_kfet/templates/registration/password_change_done.html similarity index 100% rename from apps/registration/templates/registration/password_change_done.html rename to note_kfet/templates/registration/password_change_done.html diff --git a/apps/registration/templates/registration/password_change_form.html b/note_kfet/templates/registration/password_change_form.html similarity index 100% rename from apps/registration/templates/registration/password_change_form.html rename to note_kfet/templates/registration/password_change_form.html diff --git a/apps/registration/templates/registration/password_reset_complete.html b/note_kfet/templates/registration/password_reset_complete.html similarity index 100% rename from apps/registration/templates/registration/password_reset_complete.html rename to note_kfet/templates/registration/password_reset_complete.html diff --git a/apps/registration/templates/registration/password_reset_confirm.html b/note_kfet/templates/registration/password_reset_confirm.html similarity index 100% rename from apps/registration/templates/registration/password_reset_confirm.html rename to note_kfet/templates/registration/password_reset_confirm.html diff --git a/apps/registration/templates/registration/password_reset_done.html b/note_kfet/templates/registration/password_reset_done.html similarity index 100% rename from apps/registration/templates/registration/password_reset_done.html rename to note_kfet/templates/registration/password_reset_done.html diff --git a/apps/registration/templates/registration/password_reset_form.html b/note_kfet/templates/registration/password_reset_form.html similarity index 100% rename from apps/registration/templates/registration/password_reset_form.html rename to note_kfet/templates/registration/password_reset_form.html diff --git a/apps/registration/templates/registration/signup.html b/note_kfet/templates/registration/signup.html similarity index 100% rename from apps/registration/templates/registration/signup.html rename to note_kfet/templates/registration/signup.html From beff848796075840a06e64b62012028728c01735 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Mon, 10 Aug 2020 12:08:47 +0200 Subject: [PATCH 3/4] Use a fixed-width container by default for lisibility --- apps/member/templates/member/profile_detail.html | 3 +++ apps/note/templates/note/conso_form.html | 3 +++ apps/wei/templates/wei/weiclub_detail.html | 3 +++ note_kfet/templates/base.html | 5 ++++- 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/apps/member/templates/member/profile_detail.html b/apps/member/templates/member/profile_detail.html index 297af21c..35728191 100644 --- a/apps/member/templates/member/profile_detail.html +++ b/apps/member/templates/member/profile_detail.html @@ -1,5 +1,8 @@ {% extends "member/noteowner_detail.html" %} +{# Use a fluid-width container #} +{% block containertype %}container-fluid{% endblock %} + {% block profile_info %} {% include "member/profile_info.html" %} {% endblock %} diff --git a/apps/note/templates/note/conso_form.html b/apps/note/templates/note/conso_form.html index 52c6b94f..29acb3de 100644 --- a/apps/note/templates/note/conso_form.html +++ b/apps/note/templates/note/conso_form.html @@ -5,6 +5,9 @@ {# Remove page title #} {% block contenttitle %}{% endblock %} +{# Use a fluid-width container #} +{% block containertype %}container-fluid{% endblock %} + {% block content %}
diff --git a/apps/wei/templates/wei/weiclub_detail.html b/apps/wei/templates/wei/weiclub_detail.html index d0e8f8e9..f359933f 100644 --- a/apps/wei/templates/wei/weiclub_detail.html +++ b/apps/wei/templates/wei/weiclub_detail.html @@ -1,5 +1,8 @@ {% extends "member/noteowner_detail.html" %} +{# Use a fluid-width container #} +{% block containertype %}container-fluid{% endblock %} + {% block profile_info %} {% include "wei/weiclub_info.html" %} {% endblock %} diff --git a/note_kfet/templates/base.html b/note_kfet/templates/base.html index 461d9593..5e8d3d90 100644 --- a/note_kfet/templates/base.html +++ b/note_kfet/templates/base.html @@ -72,6 +72,9 @@ SPDX-License-Identifier: GPL-3.0-or-later .bs-tooltip-bottom .arrow::before { border-bottom-color: rgba(0,0,0,.250); } + .container-fluid { + max-width: 1600px; + } {% block extracss %}{% endblock %} @@ -167,7 +170,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
-
+
{% if request.user.is_authenticated and not request.user.profile.email_confirmed %}
{% trans "Your e-mail address is not validated. Please check your mail inbox and click on the validation link." %} From bba69f0a6044af0ea4c5bc2f227b1f5c95db842f Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Mon, 10 Aug 2020 12:09:05 +0200 Subject: [PATCH 4/4] Give Pikachu as an example --- apps/member/forms.py | 4 ++++ apps/registration/forms.py | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/apps/member/forms.py b/apps/member/forms.py index 40c23485..b5577bcc 100644 --- a/apps/member/forms.py +++ b/apps/member/forms.py @@ -41,6 +41,10 @@ class ProfileForm(forms.ModelForm): 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): if not self.instance.section or (("department" in self.changed_data or "promotion" in self.changed_data) and "section" not in self.changed_data): diff --git a/apps/registration/forms.py b/apps/registration/forms.py index 02b9472e..ad258cb1 100644 --- a/apps/registration/forms.py +++ b/apps/registration/forms.py @@ -22,6 +22,11 @@ class SignUpForm(UserCreationForm): self.fields['email'].required = True 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): value = self.cleaned_data["username"] if Alias.objects.filter(normalized_name=Alias.normalize(value)).exists():