-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
34 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
from django.db import models | ||
from django.contrib.contenttypes.models import ContentType | ||
|
||
|
||
class FicheDetectionManager(models.Manager): | ||
def get_queryset(self): | ||
return super().get_queryset().filter(is_deleted=False) | ||
|
||
|
||
class VisibiliteManager(models.Manager): | ||
def get_visibilites_for_user(self, user): | ||
from sv.models import Visibilite | ||
class VisibiliteFicheManager(models.Manager): | ||
def get_visibilite_for_fiche_detection(self, fiche_detection_id): | ||
from sv.models import FicheDetection | ||
|
||
libelles = ( | ||
Visibilite.VISIBILITES_ADMINISTRATION_CENTRALE | ||
if user.agent.structure.is_mus_or_bsv | ||
else Visibilite.VISIBILITES_SERVICES_DECONCENTRES | ||
return ( | ||
self.select_related("visibilite") | ||
.get(content_type=ContentType.objects.get_for_model(FicheDetection), object_id=fiche_detection_id) | ||
.visibilite | ||
) | ||
return self.filter(libelle__in=libelles) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters