mirror of
				https://gitlab.com/animath/si/plateforme.git
				synced 2025-11-04 13:12:17 +01:00 
			
		
		
		
	Final organizers can see the team information
This commit is contained in:
		@@ -14,7 +14,7 @@ from django.views.generic import CreateView, UpdateView, DetailView, FormView
 | 
				
			|||||||
from django_tables2 import SingleTableView
 | 
					from django_tables2 import SingleTableView
 | 
				
			||||||
from tournament.forms import TeamForm, JoinTeam
 | 
					from tournament.forms import TeamForm, JoinTeam
 | 
				
			||||||
from tournament.models import Team
 | 
					from tournament.models import Team
 | 
				
			||||||
from tournament.views import AdminMixin, TeamMixin
 | 
					from tournament.views import AdminMixin, TeamMixin, OrgaMixin
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from .forms import SignUpForm, TFJMUserForm, AdminUserForm, CoachUserForm
 | 
					from .forms import SignUpForm, TFJMUserForm, AdminUserForm, CoachUserForm
 | 
				
			||||||
from .models import TFJMUser, Document, Solution, MotivationLetter, Synthesis
 | 
					from .models import TFJMUser, Document, Solution, MotivationLetter, Synthesis
 | 
				
			||||||
@@ -235,7 +235,7 @@ class OrphanedProfileListView(AdminMixin, SingleTableView):
 | 
				
			|||||||
    extra_context = dict(title=_("Orphaned profiles"), type="orphaned")
 | 
					    extra_context = dict(title=_("Orphaned profiles"), type="orphaned")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class OrganizersListView(AdminMixin, SingleTableView):
 | 
					class OrganizersListView(OrgaMixin, SingleTableView):
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    List all organizers.
 | 
					    List all organizers.
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -156,6 +156,8 @@ class TeamDetailView(LoginRequiredMixin, DetailView):
 | 
				
			|||||||
        """
 | 
					        """
 | 
				
			||||||
        if not request.user.is_authenticated or \
 | 
					        if not request.user.is_authenticated or \
 | 
				
			||||||
                (not request.user.admin and self.request.user not in self.get_object().tournament.organizers.all()
 | 
					                (not request.user.admin and self.request.user not in self.get_object().tournament.organizers.all()
 | 
				
			||||||
 | 
					                 and not (self.get_object().selected_for_final
 | 
				
			||||||
 | 
					                          and request.user in Tournament.get_final().organizers.all())
 | 
				
			||||||
                 and self.get_object() != request.user.team):
 | 
					                 and self.get_object() != request.user.team):
 | 
				
			||||||
            raise PermissionDenied
 | 
					            raise PermissionDenied
 | 
				
			||||||
        return super().dispatch(request, *args, **kwargs)
 | 
					        return super().dispatch(request, *args, **kwargs)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user