Fixed structure view

This commit is contained in:
dormantman 2020-01-21 19:28:29 +03:00
parent 88e488e481
commit 0688c622cc

View File

@ -41,14 +41,8 @@ class EmployeeEstablishmentsListView(generics.ListAPIView):
def get_queryset(self):
pk = self.kwargs.get('pk')
try:
employee = models.Employee.objects.get(pk=pk)
except ObjectDoesNotExist:
raise Http404
return employee.establishments.all()
employee = get_object_or_404(models.Employee, pk=pk)
return employee.establishments.with_extended_related()
class EstablishmentRUDView(generics.RetrieveUpdateDestroyAPIView):