Skip to content

Commit

Permalink
Corrige l'enregistrement des dispos pour les chargés de projets hors …
Browse files Browse the repository at this point in the history
…de leurs cantons
  • Loading branch information
OdyX committed Aug 30, 2017
1 parent 1fada76 commit 118271c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
1 change: 0 additions & 1 deletion apps/challenge/models/season.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ def sessions_with_qualifs(self):
).filter(qualifications__count__gt=0, )
return self.sessions_with_q


def get_absolute_url(self):
return reverse('season-detail', args=[self.pk])

Expand Down
12 changes: 11 additions & 1 deletion apps/challenge/views/season.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,17 @@ def get_context_data(self, **kwargs):
return context

def get_success_url(self):
if has_permission(self.request.user, 'challenge_season_crud'):
try:
usercantons = user_cantons(self.request.user)
except PermissionDenied:
usercantons = None
if (
has_permission(self.request.user, 'challenge_season_crud') and
list(
set(usercantons)
.intersection(set(self.season.cantons))
)
):
return reverse_lazy('season-availabilities',
kwargs={'pk': self.season.pk})
else:
Expand Down
4 changes: 3 additions & 1 deletion apps/user/views/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
from defivelo.views import MenuView

from ..forms import UserProfileForm
from ..models import DV_PRIVATE_FIELDS, DV_PUBLIC_FIELDS, PERSONAL_FIELDS, STD_PROFILE_FIELDS, UserProfile
from ..models import (
DV_PRIVATE_FIELDS, DV_PUBLIC_FIELDS, MULTISELECTFIELD_REGEXP, PERSONAL_FIELDS, STD_PROFILE_FIELDS, UserProfile,
)


class ProfileMixin(MenuView):
Expand Down

0 comments on commit 118271c

Please sign in to comment.