minor changes

This commit is contained in:
Alexander-D-Karpov 2022-11-06 11:13:42 +03:00
parent 8c25cacc76
commit 1e8c57efaf
2 changed files with 10 additions and 1 deletions

View File

@ -206,7 +206,12 @@ class ListUpdateDicomImageNumberApi(GenericAPIView):
class ListCreateProjectApi(generics.ListCreateAPIView): class ListCreateProjectApi(generics.ListCreateAPIView):
serializer_class = ListProjectSerializer def get_serializer_class(self):
if self.request.user.is_staff:
s = ListProjectSerializer
s.Meta.fields.append("user_username")
return s
return ListProjectSerializer
def get_queryset(self): def get_queryset(self):
if self.request.user.is_staff: if self.request.user.is_staff:

View File

@ -62,6 +62,10 @@ class Project(models.Model):
def __str__(self): def __str__(self):
return f"{self.user.username}'s project" return f"{self.user.username}'s project"
@property
def user_username(self):
return self.user.username
class Dicom(models.Model): class Dicom(models.Model):
slug = models.SlugField() slug = models.SlugField()