Удаление ортофотоплана
This commit is contained in:
parent
563dc5ab29
commit
5122beb959
@ -1,5 +1,6 @@
|
||||
import logging
|
||||
import os.path
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import traceback
|
||||
@ -104,7 +105,7 @@ class OrthoCreateView(CreateView):
|
||||
]
|
||||
|
||||
try:
|
||||
subprocess.run(cmd, check=True)
|
||||
subprocess.run(cmd, check=False)
|
||||
except subprocess.CalledProcessError:
|
||||
logger.error(traceback.format_exc())
|
||||
|
||||
@ -166,7 +167,10 @@ class OrthoDeleteView(DeleteView):
|
||||
) -> HttpResponseRedirect | HttpResponse:
|
||||
try:
|
||||
ortho: Ortho = self.get_object()
|
||||
path = ortho.tiles_path
|
||||
response: HttpResponseRedirect = super().delete(request, *args, **kwargs)
|
||||
rm_len = len(path) - 16
|
||||
shutil.rmtree(path[:rm_len], ignore_errors=True)
|
||||
logger.info(
|
||||
f"Удален ортофтоплан: {ortho.name} (ID: {ortho.pk}) "
|
||||
f"пользователем: {request.user} (ID: {request.user.pk})"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user