mirror of
https://github.com/Alexander-D-Karpov/akarpov
synced 2024-11-25 10:33:48 +03:00
fixed file reports
This commit is contained in:
parent
c6153b4eaf
commit
85ae29696e
|
@ -1,6 +1,8 @@
|
|||
from django.contrib import admin
|
||||
|
||||
from akarpov.files.models import File, Folder
|
||||
from akarpov.files.models import File, FileInTrash, FileReport, Folder
|
||||
|
||||
admin.site.register(File)
|
||||
admin.site.register(Folder)
|
||||
admin.site.register(FileInTrash)
|
||||
admin.site.register(FileReport)
|
||||
|
|
|
@ -17,11 +17,14 @@
|
|||
from django_tables2 import SingleTableView
|
||||
from django_tables2.export import ExportMixin
|
||||
|
||||
from akarpov.common.views import SuperUserRequiredMixin
|
||||
from akarpov.contrib.chunked_upload.exceptions import ChunkedUploadError
|
||||
from akarpov.contrib.chunked_upload.models import ChunkedUpload
|
||||
from akarpov.contrib.chunked_upload.views import (
|
||||
ChunkedUploadCompleteView,
|
||||
ChunkedUploadView,
|
||||
ChunkedUploadCompleteView as ChunkedUploadABSCompleteView,
|
||||
)
|
||||
from akarpov.contrib.chunked_upload.views import (
|
||||
ChunkedUploadView as ChunkedUploadABSView,
|
||||
)
|
||||
from akarpov.files.filters import FileFilter
|
||||
from akarpov.files.forms import FileForm, FolderForm
|
||||
|
@ -207,7 +210,7 @@ def get_redirect_url(self, *args, **kwargs):
|
|||
delete_file_view = DeleteFileView.as_view()
|
||||
|
||||
|
||||
class ChunkedUploadView(ChunkedUploadView):
|
||||
class ChunkedUploadView(ChunkedUploadABSView):
|
||||
model = ChunkedUpload
|
||||
field_name = "the_file"
|
||||
|
||||
|
@ -218,7 +221,7 @@ def check_permissions(self, request):
|
|||
)
|
||||
|
||||
|
||||
class ChunkedUploadCompleteView(ChunkedUploadCompleteView):
|
||||
class ChunkedUploadCompleteView(ChunkedUploadABSCompleteView):
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
self.message = {}
|
||||
|
@ -298,14 +301,10 @@ def get_redirect_url(self, *args, **kwargs):
|
|||
report_file = ReportFileView.as_view()
|
||||
|
||||
|
||||
class ListFileReports(LoginRequiredMixin, ListView):
|
||||
class ListFileReports(SuperUserRequiredMixin, ListView):
|
||||
model = FileReport
|
||||
queryset = FileReport.objects.all()
|
||||
template_name = "files/reports.html"
|
||||
|
||||
def get_queryset(self):
|
||||
if self.request.user.is_superuser:
|
||||
return FileReport.objects.all()
|
||||
return FileReport.objects.none()
|
||||
|
||||
|
||||
file_report_list = ListFileReports.as_view()
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
<div class="ms-3 row">
|
||||
{% if is_folder_owner %}
|
||||
{% if folder_slug %}
|
||||
<nav aria-label="breadcrumb">
|
||||
<nav class="col" aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item active" aria-current="page"><a href="{% url 'files:main' %}">home</a></li>
|
||||
{% for f in folders %}
|
||||
|
@ -45,7 +45,7 @@
|
|||
</ol>
|
||||
</nav>
|
||||
{% else %}
|
||||
<nav aria-label="breadcrumb">
|
||||
<nav class="col" aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item active" aria-current="page"><a href="{% url 'files:main' %}">home</a></li>
|
||||
</ol>
|
||||
|
@ -53,9 +53,13 @@
|
|||
{% endif %}
|
||||
{% endif %}
|
||||
{% if request.user.is_authenticated and is_folder_owner %}
|
||||
<div class="d-flex justify-content-end me-5">
|
||||
<div class="d-flex justify-content-end me-5 col">
|
||||
<a class="me-5" href="{% url 'files:table' %}">table view</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="row">
|
||||
{% if request.user.is_authenticated and is_folder_owner %}
|
||||
<div class="col-lg-2 col-xxl-2 col-md-4 col-sm-6 col-xs-12 mb-3 m-3 d-flex align-items-stretch card">
|
||||
<div class="card-body d-flex flex-column justify-content-center align-items-center">
|
||||
{% csrf_token %}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{% extends 'base.html' %}
|
||||
{% load humanize %}
|
||||
|
||||
{% block content %}
|
||||
<div class="list-group">
|
||||
{% for file in filereport_list %}
|
||||
<a href="{{ file.file.get_absolute_url }}" class="list-group-item list-group-item-action">
|
||||
|
@ -12,3 +13,4 @@
|
|||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in New Issue
Block a user