mirror of https://github.com/interlegis/sigi.git
8 changed files with 432 additions and 18 deletions
@ -0,0 +1,82 @@ |
|||
# Generated by Django 6.0.5 on 2026-10-08 15:18 |
|||
|
|||
import django.db.models.deletion |
|||
from django.db import migrations, models |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
("casas", "0027_alter_orgao_email"), |
|||
("eventos", "0066_viw_eventos_paricipante"), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.CreateModel( |
|||
name="LocalVisita", |
|||
fields=[ |
|||
( |
|||
"id", |
|||
models.BigAutoField( |
|||
auto_created=True, |
|||
primary_key=True, |
|||
serialize=False, |
|||
verbose_name="ID", |
|||
), |
|||
), |
|||
( |
|||
"nome", |
|||
models.CharField( |
|||
max_length=100, verbose_name="nome do local" |
|||
), |
|||
), |
|||
( |
|||
"descricao", |
|||
models.TextField(verbose_name="descrição do local"), |
|||
), |
|||
], |
|||
options={ |
|||
"verbose_name": "local de visita", |
|||
"verbose_name_plural": "locais de visita", |
|||
}, |
|||
), |
|||
migrations.CreateModel( |
|||
name="Visita", |
|||
fields=[], |
|||
options={ |
|||
"verbose_name": "Visita", |
|||
"verbose_name_plural": "Visitas", |
|||
"proxy": True, |
|||
"indexes": [], |
|||
"constraints": [], |
|||
}, |
|||
bases=("eventos.evento",), |
|||
), |
|||
migrations.AddField( |
|||
model_name="evento", |
|||
name="pesquisa_previa", |
|||
field=models.URLField(blank=True, verbose_name="pesquisa prévia"), |
|||
), |
|||
migrations.AlterField( |
|||
model_name="evento", |
|||
name="casa_anfitria", |
|||
field=models.ForeignKey( |
|||
blank=True, |
|||
null=True, |
|||
on_delete=django.db.models.deletion.PROTECT, |
|||
to="casas.orgao", |
|||
verbose_name="instituição / casa anfitriã", |
|||
), |
|||
), |
|||
migrations.AddField( |
|||
model_name="evento", |
|||
name="local_visita", |
|||
field=models.ForeignKey( |
|||
blank=True, |
|||
null=True, |
|||
on_delete=django.db.models.deletion.PROTECT, |
|||
to="eventos.localvisita", |
|||
verbose_name="local da visita", |
|||
), |
|||
), |
|||
] |
|||
@ -0,0 +1,27 @@ |
|||
# Generated by Django 6.0.5 on 2026-10-08 15:22 |
|||
|
|||
from django.db import migrations |
|||
|
|||
|
|||
def forward(apps, schema_editor): |
|||
Evento = apps.get_model("eventos", "Evento") |
|||
for visita in Evento.objects.filter(tipo_evento__categoria="V"): |
|||
if visita.convite_set.count() == 1: |
|||
visita.casa_anfitria = visita.convite_set.first().casa |
|||
visita.save() |
|||
|
|||
|
|||
def backward(apps, schema_editor): |
|||
Evento = apps.get_model("eventos", "Evento") |
|||
Orgao = apps.get_model("casas", "Orgao") |
|||
senado = Orgao.objects.get(tipo__sigla="SF") |
|||
Evento.objects.filter(tipo_evento__categoria="V").update( |
|||
casa_anfitria=senado |
|||
) |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
dependencies = [ |
|||
("eventos", "0067_localvisita_visita_evento_pesquisa_previa_and_more"), |
|||
] |
|||
operations = [migrations.RunPython(forward, backward)] |
|||
@ -0,0 +1,10 @@ |
|||
{% extends "admin/change_form_object_tools.html" %} |
|||
{% load i18n admin_urls djbs_extras %} |
|||
|
|||
{% block object-tools-items %} |
|||
{{ block.super }} |
|||
{% url opts|admin_urlname:'declaracaoreport' original.pk|admin_urlquote as declaracao_url %} |
|||
<a class="addlink nav-link declaracao" href="{% add_preserved_filters declaracao_url %}" aria-labelledby="text-tool-declaracao" title="{% translate 'Declaração' %}"> |
|||
{% icon "pdf" %} <span id="text-tool-declaracao" class="d-lg-none">{% translate "Declaração" %}</span> |
|||
</a> |
|||
{% endblock %} |
|||
Loading…
Reference in new issue