Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Django version and optimize queryset retrieval in views to avo… #146

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading