Удаление ортофотоплана

This commit is contained in:
zakhy 2025-04-15 16:05:50 +07:00
parent bbda907a1d
commit e569e0fa7d
4 changed files with 738 additions and 522 deletions

View File

@ -0,0 +1,87 @@
{% extends "default.html" %}
{% load static %}
{% load mysettings %}
{% block header_link %}
<!-- Select2 -->
<link rel="stylesheet"
href="{% static 'lte/plugins/select2/css/select2.min.css' %}?ver={% settings_value 'APP_VER' %}">
<link rel="stylesheet"
href="{% static 'lte/plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css' %}?ver={% settings_value 'APP_VER' %}">
<!-- iCheck for checkboxes and radio inputs -->
<link rel="stylesheet"
href="{% static 'lte/plugins/icheck-bootstrap/icheck-bootstrap.min.css' %}?ver={% settings_value 'APP_VER' %}">
<style>
.file-upload-label {
cursor: pointer;
border: 1px solid #ced4da;
padding: .375rem .75rem;
border-radius: .25rem;
font-weight: normal !important;
}
</style>
{% endblock header_link %}
{% block content %}
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h4>Удаление ортофотоплана</h4>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="/management/">Главная</a></li>
<li class="breadcrumb-item"><a href="/management/">Параметры системы</a></li>
</ol>
</div>
</div>
</div><!-- /.container-fluid -->
</section>
<section class="content">
<form autocomplete="off" method="post" enctype="multipart/form-data" class="form-horizontal">
{% csrf_token %}
<div class="container-fluid">
<div class="row">
<!-- /.col -->
<div class="col-12">
<div class="card">
<div class="card-header">Удаление ортофотоплана</div>
<div class="card-body">
<p>Вы уверены, что хотите удалить ортофотоплан?</p>
</div><!-- /.card-body -->
<div class="card-footer">
<button id="btnok" type="submit" class="btn bg-gradient-danger">Удалить</button>
<a href="/management/" type="button" class="btn btn-default float-right">Отмена</a>
</div>
</div>
<!-- /.nav-tabs-custom -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</div><!-- /.container-fluid -->
</form>
</section>
{% endblock %}
{% block script_footer %}
<script>
const inputArr = document.querySelectorAll('.show-name')
for (let arr of inputArr) {
arr.addEventListener('change', function (event) {
const fileNameDisplay = document.getElementById('file-name');
const file = event.target.files[0];
if (file) {
fileNameDisplay.style.display = 'block';
fileNameDisplay.innerHTML = `Сейчас выбран: <a href="#" download="${file.name}">${file.name}</a>`;
} else {
fileNameDisplay.style.display = 'none';
}
});
}
</script>
{% endblock script_footer %}

File diff suppressed because it is too large Load Diff

View File

@ -4,12 +4,13 @@ from django.conf.urls import ( # Используйте include() чтобы д
from django.contrib.auth.decorators import login_required
from apps.management.views import views_management, views_user
from apps.management.views.views_settings import add_orthomosaic, gto_icon_add
from apps.management.views.views_settings import add_orthomosaic, gto_icon_add, remove_orthomosaic
urlpatterns = [
url(r"^$", views_management.main_index, name="main_index"),
url(r"^gto_icon_add/$", gto_icon_add, name="gto_icon_add"),
url(r"add_orthomosaic/$", add_orthomosaic, name="add_orthomosaic"),
url(r"remove_orthomosaic/$", remove_orthomosaic, name="remove_orthomosaic"),
url(r"^user/add/$", views_user.user_add, name="user_add"),
url(r"^user/$", views_user.user_edit, name="user_edit"),
url(r"^user/password/$", views_user.user_password_edit, name="user_password_edit"),

View File

@ -72,8 +72,9 @@ def oset_save(request):
continue
if param == "geoproc_many_sectors":
# TODO вынужденный костыль. До переработки системы настроек
another_sectors_exists = Sector.objects.all().exclude(
name="Основной участок").exists()
another_sectors_exists = (
Sector.objects.all().exclude(name="Основной участок").exists()
)
if another_sectors_exists:
continue
element_link = Settings.objects.filter(name=param).first()
@ -210,6 +211,21 @@ def main_index(request):
return redirect("/management/")
@login_required(login_url="/")
@never_cache
def remove_orthomosaic(request):
try:
if request.method == "GET":
context = generalmodule.get_context_template()
return render(request, "remove_orthomosaic.html", context)
if request.method == "POST":
shutil.rmtree("media/map/orth")
return redirect("/management/")
except Exception as err:
logging.error(traceback.format_exc())
return redirect("/management/")
@login_required(login_url="/")
@never_cache
def add_orthomosaic(request):