|
|
@ -15,7 +15,7 @@ from django.db import connection, transaction |
|
|
|
from django.db.models import Q |
|
|
|
from django.db.utils import IntegrityError |
|
|
|
from django.http.response import (HttpResponse, HttpResponseRedirect, |
|
|
|
JsonResponse) |
|
|
|
JsonResponse, Http404) |
|
|
|
from django.shortcuts import get_object_or_404, redirect |
|
|
|
from django.utils.dateparse import parse_date |
|
|
|
from django.utils.encoding import force_text |
|
|
@ -51,7 +51,6 @@ from sapl.compilacao.utils import (DISPOSITIVO_SELECT_RELATED, |
|
|
|
from sapl.crud.base import Crud, CrudAux, CrudListView, make_pagination |
|
|
|
from sapl.settings import BASE_DIR |
|
|
|
|
|
|
|
|
|
|
|
TipoNotaCrud = CrudAux.build(TipoNota, 'tipo_nota') |
|
|
|
TipoVideCrud = CrudAux.build(TipoVide, 'tipo_vide') |
|
|
|
TipoPublicacaoCrud = CrudAux.build(TipoPublicacao, 'tipo_publicacao') |
|
|
@ -211,8 +210,12 @@ class CompMixin(PermissionRequiredMixin): |
|
|
|
|
|
|
|
@property |
|
|
|
def ta(self): |
|
|
|
try: |
|
|
|
ta = TextoArticulado.objects.get( |
|
|
|
pk=self.kwargs.get('ta_id', self.kwargs.get('pk', 0))) |
|
|
|
except TextoArticulado.DoesNotExist: |
|
|
|
raise Http404() |
|
|
|
|
|
|
|
return ta |
|
|
|
|
|
|
|
def get_context_data(self, **kwargs): |
|
|
@ -1480,12 +1483,18 @@ class ActionDeleteDispositivoMixin(ActionsCommonsMixin): |
|
|
|
).first() |
|
|
|
|
|
|
|
data = {} |
|
|
|
if base_anterior: |
|
|
|
data = self.get_json_for_refresh(base_anterior) |
|
|
|
else: |
|
|
|
if not base_anterior or base == base.get_raiz(): |
|
|
|
base_anterior = base.get_nivel_zero_anterior() |
|
|
|
if not base_anterior: |
|
|
|
base_anterior = base |
|
|
|
data = self.get_json_for_refresh(base_anterior) |
|
|
|
|
|
|
|
if base == base_anterior: |
|
|
|
data['pk'] = base.pk |
|
|
|
self.set_message(data, 'danger', _( |
|
|
|
'Base Inicial não pode ser removida!'), modal=True) |
|
|
|
else: |
|
|
|
if base != base.get_raiz(): |
|
|
|
data['pai'] = [base.get_raiz().pk] |
|
|
|
|
|
|
|
if ta_base.id != int(self.kwargs['ta_id']): |
|
|
|