Skip to content

Commit

Permalink
Merge pull request #146 from CodeHive-Solutions/dev
Browse files Browse the repository at this point in the history
Update Django version and optimize queryset retrieval in views to avo…
  • Loading branch information
Heibert authored Dec 2, 2024
2 parents 1e509d0 + c8873af commit 51e9b07
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion INSIGHTSAPI/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
celery==5.4.0
chardet==5.2.0
Django==5.0.7
Django==5.1.3
django_auth_ldap==4.8.0
django-cors-headers==4.4.0
django_sendfile2==0.7.1
Expand Down
5 changes: 1 addition & 4 deletions INSIGHTSAPI/sgc/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
import logging
from django.core.cache import cache
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_page, cache_control
from django.utils.cache import get_cache_key
from rest_framework import renderers
from django.views.decorators.cache import cache_page
from rest_framework.permissions import IsAuthenticated, DjangoModelPermissions
from rest_framework import viewsets
from services.views import FileDownloadMixin
Expand All @@ -23,7 +21,6 @@ class SGCFileViewSet(viewsets.ModelViewSet):

queryset = SGCFile.objects.all().select_related("area")
serializer_class = SGCFileSerializer
# renderer_classes = [renderers.BrowsableAPIRenderer]
permission_classes = [IsAuthenticated, DjangoModelPermissions]

@method_decorator(cache_page(CACHE_DURATION, key_prefix="sgc"))
Expand Down
4 changes: 2 additions & 2 deletions INSIGHTSAPI/vacation/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ def get_queryset(self):

# If the user is a manager of HR
if user.job_position.name == "GERENTE DE GESTION HUMANA":
return self.queryset
return self.queryset.all()

# If the user has payroll approval permissions
elif user.has_perm("vacation.payroll_approval"):
return self.queryset
return self.queryset.all()

# If the user has a management position with rank >= 2
elif user.job_position.rank >= 2:
Expand Down

0 comments on commit 51e9b07

Please sign in to comment.