|
@ -183,8 +183,9 @@ class CasaLegislativaTableAuxView(FormMixin, GenericView): |
|
|
|
|
|
|
|
|
if form.is_valid(): |
|
|
if form.is_valid(): |
|
|
casa = CasaLegislativa.objects.first() |
|
|
casa = CasaLegislativa.objects.first() |
|
|
if casa is not None: |
|
|
if casa: |
|
|
if "remover" in request.POST: |
|
|
if ("remover" in request.POST or |
|
|
|
|
|
(form.cleaned_data['logotipo'] and casa.logotipo)): |
|
|
try: |
|
|
try: |
|
|
os.unlink(casa.logotipo.path) |
|
|
os.unlink(casa.logotipo.path) |
|
|
except OSError: |
|
|
except OSError: |
|
@ -196,7 +197,7 @@ class CasaLegislativaTableAuxView(FormMixin, GenericView): |
|
|
instance=casa |
|
|
instance=casa |
|
|
).save(commit=False) |
|
|
).save(commit=False) |
|
|
casa_save.save() |
|
|
casa_save.save() |
|
|
elif casa is None: |
|
|
else: |
|
|
form.save() |
|
|
form.save() |
|
|
return self.form_valid(form) |
|
|
return self.form_valid(form) |
|
|
else: |
|
|
else: |
|
|