switch from ownCloud to minIO

buttons in table are buttons and do edit and delete properly
This commit is contained in:
2025-07-29 18:51:09 +03:00
parent 4603953458
commit c1183c22ea
40 changed files with 1263 additions and 241 deletions
+6 -5
View File
@@ -1,17 +1,18 @@
from django.urls import path, include
from preinfo.views.client_views import (ClientPreinfoView, check_preinfo, PreinfoSearchView, ClientPreinfoCreateView, ClientPreinfoUpdateView)
from preinfo.views.client_views import (ClientPreinfoView, check_preinfo, PreinfoSearchView, ClientPreinfoCreateView,
ClientPreinfoUpdateView, ClientPreinfoDeleteView, )
from preinfo.views.employee_views import EmployeePreinfoView
urlpatterns = [
path('client/', include([
path('', ClientPreinfoView.as_view(), name='client_preinfo'),
path('create/', ClientPreinfoCreateView.as_view(), name='client_preinfo_create'),
path('<int:pk>/update/', ClientPreinfoUpdateView.as_view(), name='client_preinfo_update'),
path('<int:pk>/delete/', ClientPreinfoDeleteView.as_view(), name='client_preinfo_delete'),
])),
path('check-preinfo/', check_preinfo, name='check_preinfo'),
path('preinfo-search/', PreinfoSearchView.as_view(), name='preinfo_search'),
path('employee/', include([
path('', EmployeePreinfoView.as_view(), name='employee_preinfo'),
])
)
]
])
)
]
+21
View File
@@ -1,9 +1,13 @@
from datetime import timezone
from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin
from django.http import JsonResponse
from django.shortcuts import render, redirect
from django.urls import reverse_lazy
from django.utils.timezone import now
from django.views import View
from django.views.generic import CreateView, ListView, UpdateView
from rest_framework.generics import get_object_or_404
from DepoT.mixins.LineFiltweFormMixin import LineFilterFormMixin
from common.utils.utils import filter_queryset_by_user, get_preinfo_by_number, send_test_email
@@ -98,3 +102,20 @@ class PreinfoSearchView(View):
return render(request, self.template_name, {'error': 'Not found'})
class ClientPreinfoDeleteView(LoginRequiredMixin, UserPassesTestMixin, View):
success_url = reverse_lazy('client_preinfo')
def test_func(self):
return self.request.user.has_company_perm('can_manage_preinfo') or self.request.user.user_type == 'CA'
def post(self, request, pk, *args, **kwargs):
target_preinfo = get_object_or_404(Preinfo, pk=pk)
if target_preinfo.received:
return JsonResponse({'success': False, 'error': 'Cannot delete completed preinfo.'})
if target_preinfo.deleted:
return JsonResponse({'success': False, 'error': 'Preinfo already deleted.'})
target_preinfo.deleted = True
target_preinfo.deleted_on = now()
target_preinfo.deleted_by = request.user
target_preinfo.save()
return JsonResponse({'success': True, 'is_active': target_preinfo.active})