mirror of
				https://gitlab.crans.org/bde/nk20
				synced 2025-11-04 09:12:11 +01:00 
			
		
		
		
	Merge branch 'family' into 'main'
INSTALLED_APPS checks See merge request bde/nk20!347
This commit is contained in:
		@@ -1,6 +1,8 @@
 | 
			
		||||
# Copyright (C) 2018-2025 by BDE ENS Paris-Saclay
 | 
			
		||||
# SPDX-License-Identifier: GPL-3.0-or-later
 | 
			
		||||
 | 
			
		||||
from django.conf import settings
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def save_user_profile(instance, created, raw, **_kwargs):
 | 
			
		||||
    """
 | 
			
		||||
@@ -16,7 +18,7 @@ def save_user_profile(instance, created, raw, **_kwargs):
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def update_wei_registration_fee_on_membership_creation(sender, instance, created, **kwargs):
 | 
			
		||||
    if not hasattr(instance, "_no_signal") and created:
 | 
			
		||||
    if not hasattr(instance, "_no_signal") and 'wei' in settings.INSTALLED_APPS and created:
 | 
			
		||||
        from wei.models import WEIRegistration
 | 
			
		||||
        if instance.club.id == 1 or instance.club.id == 2:
 | 
			
		||||
            registrations = WEIRegistration.objects.filter(
 | 
			
		||||
@@ -29,8 +31,8 @@ def update_wei_registration_fee_on_membership_creation(sender, instance, created
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def update_wei_registration_fee_on_club_change(sender, instance, **kwargs):
 | 
			
		||||
    from wei.models import WEIRegistration
 | 
			
		||||
    if not hasattr(instance, "_no_signal") and (instance.id == 1 or instance.id == 2):
 | 
			
		||||
    if not hasattr(instance, "_no_signal") and 'wei' in settings.INSTALLED_APPS and (instance.id == 1 or instance.id == 2):
 | 
			
		||||
        from wei.models import WEIRegistration
 | 
			
		||||
        registrations = WEIRegistration.objects.filter(
 | 
			
		||||
            wei__year=instance.membership_start.year,
 | 
			
		||||
        )
 | 
			
		||||
 
 | 
			
		||||
@@ -7,16 +7,19 @@
 | 
			
		||||
    <dt class="col-xl-6">{% trans 'username'|capfirst %}</dt>
 | 
			
		||||
    <dd class="col-xl-6">{{ user_object.username }}</dd>
 | 
			
		||||
 | 
			
		||||
    {% if family_app_installed %}
 | 
			
		||||
    <dt class="col-xl-6">{% trans 'family'|capfirst %}</dt>
 | 
			
		||||
    <dd class="col-xl-6">
 | 
			
		||||
        {% if families %}
 | 
			
		||||
            test
 | 
			
		||||
            {% for fam in families %}
 | 
			
		||||
            <a href="{% url 'family:family_detail' fam.pk %}">{{ fam.name }}</a>{% if not forloop.last %}, {% endif %}
 | 
			
		||||
            <a href="{% url 'family:family_detail' fam.pk %}">asfafs{{ fam.name }}</a>{% if not forloop.last %}, {% endif %}
 | 
			
		||||
            {% endfor %}
 | 
			
		||||
        {% else %}
 | 
			
		||||
            <span class="text-muted">Aucune</span>
 | 
			
		||||
        {% endif %}
 | 
			
		||||
    </dd>
 | 
			
		||||
    {% endif %}
 | 
			
		||||
 | 
			
		||||
    {% if user_object.pk == user.pk %}
 | 
			
		||||
    <dt class="col-xl-6">{% trans 'password'|capfirst %}</dt>
 | 
			
		||||
 
 | 
			
		||||
@@ -207,9 +207,10 @@ class UserDetailView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView):
 | 
			
		||||
            modified_note.is_active = True
 | 
			
		||||
            context["can_unlock_note"] = not user.note.is_active and PermissionBackend\
 | 
			
		||||
                .check_perm(self.request, "note.change_noteuser_is_active", modified_note)
 | 
			
		||||
 | 
			
		||||
        families = Family.objects.filter(memberships__user=user).distinct()
 | 
			
		||||
        context["families"] = families
 | 
			
		||||
        if 'family' in settings.INSTALLED_APPS:
 | 
			
		||||
            context["family_app_installed"] = True
 | 
			
		||||
            families = Family.objects.filter(memberships__user=user).distinct()
 | 
			
		||||
            context["families"] = families
 | 
			
		||||
 | 
			
		||||
        return context
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user