mirror of https://gitlab.crans.org/bde/nk20
Don't change the password of another member (+ minor fixes on WEI app)
This commit is contained in:
parent
eb39aff1ab
commit
8c0ccdfdd0
|
@ -119,7 +119,7 @@ class Profile(models.Model):
|
||||||
def soge(self):
|
def soge(self):
|
||||||
if "treasury" in settings.INSTALLED_APPS:
|
if "treasury" in settings.INSTALLED_APPS:
|
||||||
from treasury.models import SogeCredit
|
from treasury.models import SogeCredit
|
||||||
return SogeCredit.objects.filter(user=self.user, credit_transaction=None).exists()
|
return SogeCredit.objects.filter(user=self.user, credit_transaction__isnull=False).exists()
|
||||||
return False
|
return False
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
from datetime import date
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
|
@ -17,6 +18,7 @@ class WEIClub(Club):
|
||||||
"""
|
"""
|
||||||
year = models.PositiveIntegerField(
|
year = models.PositiveIntegerField(
|
||||||
unique=True,
|
unique=True,
|
||||||
|
default=date.today().year,
|
||||||
verbose_name=_("year"),
|
verbose_name=_("year"),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -780,7 +780,7 @@ class WEIValidateRegistrationView(ProtectQuerysetMixin, LoginRequiredMixin, Crea
|
||||||
ret = super().form_valid(form)
|
ret = super().form_valid(form)
|
||||||
|
|
||||||
membership.refresh_from_db()
|
membership.refresh_from_db()
|
||||||
membership.roles.add(WEIRole.objects.get("Adhérent WEI"))
|
membership.roles.add(WEIRole.objects.get(name="Adhérent WEI"))
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
|
@ -17,12 +17,14 @@
|
||||||
<dt class="col-xl-6">{% trans 'username'|capfirst %}</dt>
|
<dt class="col-xl-6">{% trans 'username'|capfirst %}</dt>
|
||||||
<dd class="col-xl-6">{{ object.username }}</dd>
|
<dd class="col-xl-6">{{ object.username }}</dd>
|
||||||
|
|
||||||
|
{% if object.pk == user.pk %}
|
||||||
<dt class="col-xl-6">{% trans 'password'|capfirst %}</dt>
|
<dt class="col-xl-6">{% trans 'password'|capfirst %}</dt>
|
||||||
<dd class="col-xl-6">
|
<dd class="col-xl-6">
|
||||||
<a class="small" href="{% url 'password_change' %}">
|
<a class="small" href="{% url 'password_change' %}">
|
||||||
{% trans 'Change password' %}
|
{% trans 'Change password' %}
|
||||||
</a>
|
</a>
|
||||||
</dd>
|
</dd>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<dt class="col-xl-6">{% trans 'section'|capfirst %}</dt>
|
<dt class="col-xl-6">{% trans 'section'|capfirst %}</dt>
|
||||||
<dd class="col-xl-6">{{ object.profile.section }}</dd>
|
<dd class="col-xl-6">{{ object.profile.section }}</dd>
|
||||||
|
|
|
@ -31,13 +31,6 @@
|
||||||
</dd>
|
</dd>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<dt class="col-xl-6">{% trans 'password'|capfirst %}</dt>
|
|
||||||
<dd class="col-xl-6">
|
|
||||||
<a class="small" href="{% url 'password_change' %}">
|
|
||||||
{% trans 'Change password' %}
|
|
||||||
</a>
|
|
||||||
</dd>
|
|
||||||
|
|
||||||
<dt class="col-xl-6">{% trans 'section'|capfirst %}</dt>
|
<dt class="col-xl-6">{% trans 'section'|capfirst %}</dt>
|
||||||
<dd class="col-xl-6">{{ object.profile.section }}</dd>
|
<dd class="col-xl-6">{{ object.profile.section }}</dd>
|
||||||
|
|
||||||
|
|
|
@ -119,8 +119,10 @@
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-footer text-center">
|
<div class="card-footer text-center">
|
||||||
<a class="btn btn-primary btn-sm" href="{% url 'member:user_update_profile' registration.user.pk %}">{% trans 'Update Profile' %}</a>
|
|
||||||
<a class="btn btn-primary btn-sm" href="{% url 'wei:wei_update_registration' registration.pk %}">{% trans 'Update registration' %}</a>
|
<a class="btn btn-primary btn-sm" href="{% url 'wei:wei_update_registration' registration.pk %}">{% trans 'Update registration' %}</a>
|
||||||
|
{% if "auth.change_user"|has_perm:registration.user %}
|
||||||
|
<a class="btn btn-primary btn-sm" href="{% url 'member:user_update_profile' registration.user.pk %}">{% trans 'Update Profile' %}</a>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue