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
+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})