From 91c68843abb6db93001e15086a7f999ab8a12c96 Mon Sep 17 00:00:00 2001 From: Marsel Narbekov Date: Mon, 2 Sep 2024 21:53:42 +0300 Subject: [PATCH 1/2] Vacancy expiration_check 30 -> 90 days --- vacancy/managers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vacancy/managers.py b/vacancy/managers.py index 62e24016..f086a39d 100644 --- a/vacancy/managers.py +++ b/vacancy/managers.py @@ -5,7 +5,7 @@ class VacancyManager(Manager): def get_vacancy_for_list_view(self): - expiration_check = datetime.datetime.now() - datetime.timedelta(days=30) + expiration_check = datetime.datetime.now() - datetime.timedelta(days=90) return ( self.get_queryset() .select_related("project") From 1eabe1d806e0c54809f1a715efecc853d2c21dbf Mon Sep 17 00:00:00 2001 From: Marsel Narbekov Date: Tue, 3 Sep 2024 19:12:49 +0300 Subject: [PATCH 2/2] =?UTF-8?q?PRO-447:=20CRUD=20with=20files=20for=20"?= =?UTF-8?q?=D0=A0=D1=83=D0=BA=D0=BE=D0=B2=D0=BE=D0=B4=D0=B8=D1=82=D0=B5?= =?UTF-8?q?=D0=BB=D1=8C=20=D0=BF=D1=80=D0=BE=D0=B3=D1=80=D0=B0=D0=BC=D0=BC?= =?UTF-8?q?=D1=8B"=20In=20admin=20panel.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- files/admin.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/files/admin.py b/files/admin.py index 7cb3454c..75d70239 100644 --- a/files/admin.py +++ b/files/admin.py @@ -2,6 +2,7 @@ from django.contrib import admin from django.forms import ModelForm, FileField +from django.db.models import QuerySet from files.service import CDN, SelectelSwiftStorage from files.models import UserFile @@ -81,3 +82,9 @@ def delete_queryset(self, request, queryset): for obj in queryset: self.cdn.delete(obj.link) queryset.delete() + + def get_queryset(self, request) -> QuerySet[UserFile]: + qs = super().get_queryset(request) + if request.user.groups.filter(name="Руководитель программы").exists(): + return qs.filter(user=request.user) + return qs