-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #973 from ricval/Exhortos
Exhortos - Modelos
- Loading branch information
Showing
12 changed files
with
223 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
""" | ||
Exh Exhortos | ||
""" | ||
|
||
from sqlalchemy.sql import func | ||
|
||
from plataforma_web.extensions import db | ||
from lib.universal_mixin import UniversalMixin | ||
|
||
class ExhExhorto(db.Model, UniversalMixin): | ||
"""Exhorto Exhorto""" | ||
|
||
# Nombre de la tabla | ||
__tablename__ = "exh_exhortos" | ||
|
||
# Clave primaria | ||
id = db.Column(db.Integer, primary_key=True) | ||
|
||
# UUID identificador con el que el PJ exhortante identifica el exhorto que envía | ||
exhorto_origen_id = db.Column(db.String(64), nullable=False, unique=True) | ||
|
||
# Identificador INEGI del Municipio del Estado del PJ exhortado al que se quiere enviar el Exhorto | ||
# municipio_destino_id = db.Column(db.Integer, db.ForeignKey("municipios.id"), index=True, nullable=False) | ||
# municipio_destino = db.relationship("Municipio", back_populates="exh_exhortos_destinos") | ||
|
||
# Clave de la materia (el que se obtuvo en la consulta de materias del PJ exhortado) al que el Exhorto hace referencia | ||
materia_id = db.Column(db.Integer, db.ForeignKey("materias.id"), index=True, nullable=False) | ||
materia = db.relationship("Materia", back_populates="exh_exhortos") | ||
|
||
# Identificador INEGI del Estado de origen del Municipio donde se ubica el Juzgado del PJ exhortante | ||
# estado_origen_id = Column(Integer, ForeignKey("estados.id"), index=True, nullable=False) | ||
# estado_origen = relationship("Estado", back_populates="exhortos") | ||
|
||
# Identificador INEGI del Municipio donde está localizado el Juzgado del PJ exhortante | ||
municipio_origen_id = db.Column(db.Integer, db.ForeignKey("municipios.id"), index=True, nullable=False) | ||
municipio_origen = db.relationship("Municipio", back_populates="exh_exhortos_origenes") | ||
|
||
# Identificador propio del Juzgado/Área que envía el Exhorto | ||
juzgado_origen_id = db.Column(db.String(64)) | ||
# Nombre del Juzgado/Área que envía el Exhorto | ||
juzgado_origen_nombre = db.Column(db.String(256), nullable=False) | ||
# El número de expediente (o carpeta procesal, carpeta...) que tiene el asunto en el Juzgado de Origen | ||
numero_expediente_origen = db.Column(db.String(256), nullable=False) | ||
numero_oficio_origen = db.Column(db.String(256)) | ||
tipo_juicio_asunto_delitos = db.Column(db.String(256), nullable=False) | ||
juez_exhortante = db.Column(db.String(256)) | ||
fojas = db.Column(db.Integer, nullable=False) | ||
dias_responder = db.Column(db.Integer, nullable=False) | ||
tipo_diligenciacion_nombre = db.Column(db.String(256)) | ||
fecha_origen = db.Column(db.DateTime, server_default=func.now()) | ||
observaciones = db.Column(db.String(1024)) | ||
|
||
# Hijos | ||
# partes PersonaParte[] NO | ||
exh_exhortos_partes = db.relationship('ExhExhortoParte', back_populates='exh_exhorto', lazy='noload') | ||
# archivos ArchivoARecibir[] SI | ||
exh_exhortos_archivos = db.relationship('ExhExhortoArchivo', back_populates='exh_exhorto', lazy='noload') | ||
|
||
def __repr__(self): | ||
"""Representación""" | ||
return f"<Exhorto {self.id}>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
""" | ||
Exh Exhortos, vistas | ||
""" | ||
|
||
import json | ||
from flask import Blueprint, flash, redirect, render_template, request, url_for | ||
from flask_login import current_user, login_required | ||
|
||
from lib.datatables import get_datatable_parameters, output_datatable_json | ||
from lib.safe_string import safe_clave, safe_string | ||
|
||
from plataforma_web.blueprints.bitacoras.models import Bitacora | ||
from plataforma_web.blueprints.modulos.models import Modulo | ||
from plataforma_web.blueprints.permisos.models import Permiso | ||
from plataforma_web.blueprints.usuarios.decorators import permission_required | ||
from plataforma_web.blueprints.exh_exhortos.models import ExhExhorto | ||
|
||
MODULO = "EXH EXHORTOS" | ||
|
||
exh_exhortos = Blueprint("exh_exhortos", __name__, template_folder="templates") | ||
|
||
|
||
@exh_exhortos.before_request | ||
@login_required | ||
@permission_required(MODULO, Permiso.VER) | ||
def before_request(): | ||
"""Permiso por defecto""" |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
""" | ||
Exh Exhortos Archivos | ||
""" | ||
|
||
from plataforma_web.extensions import db | ||
from lib.universal_mixin import UniversalMixin | ||
|
||
class ExhExhortoArchivo(db.Model, UniversalMixin): | ||
"""Exhorto Archivo""" | ||
|
||
# Nombre de la tabla | ||
__tablename__ = "exh_exhortos_archivos" | ||
|
||
# Clave primaria | ||
id = db.Column(db.Integer, primary_key=True) | ||
|
||
# Clave foránea | ||
exh_exhorto_id = db.Column(db.Integer, db.ForeignKey('exh_exhortos.id'), index=True, nullable=False) | ||
exh_exhorto = db.relationship('ExhExhorto', back_populates='exh_exhortos_archivos') | ||
|
||
# Columnas | ||
nombre_archivo = db.Column(db.String(256), nullable=False) | ||
hash_sha1 = db.Column(db.String(256)) | ||
hash_sha256 = db.Column(db.String(256)) | ||
tipo_documento = db.Column(db.Integer(), nullable=False) # 1=Oficio, 2=Acuerdo, 3=Anexo | ||
|
||
def __repr__(self): | ||
"""Representación""" | ||
return f"<ExhExhortoArchivo {self.nombre_archivo}>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
""" | ||
Exh Exhortos Archivos, vistas | ||
""" | ||
|
||
import json | ||
from flask import Blueprint, flash, redirect, render_template, request, url_for | ||
from flask_login import current_user, login_required | ||
|
||
from lib.datatables import get_datatable_parameters, output_datatable_json | ||
from lib.safe_string import safe_clave, safe_string | ||
|
||
from plataforma_web.blueprints.bitacoras.models import Bitacora | ||
from plataforma_web.blueprints.modulos.models import Modulo | ||
from plataforma_web.blueprints.permisos.models import Permiso | ||
from plataforma_web.blueprints.usuarios.decorators import permission_required | ||
from plataforma_web.blueprints.exh_exhortos_archivos.models import ExhExhortoArchivo | ||
|
||
MODULO = "EXH EXHORTOS ARCHIVOS" | ||
|
||
exh_exhortos_archivos = Blueprint("exh_exhortos_archivos", __name__, template_folder="templates") | ||
|
||
|
||
@exh_exhortos_archivos.before_request | ||
@login_required | ||
@permission_required(MODULO, Permiso.VER) | ||
def before_request(): | ||
"""Permiso por defecto""" |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
""" | ||
Exhortos Partes Persona | ||
""" | ||
|
||
from collections import OrderedDict | ||
from plataforma_web.extensions import db | ||
from lib.universal_mixin import UniversalMixin | ||
|
||
class ExhExhortoParte(db.Model, UniversalMixin): | ||
"""Exhorto Parte""" | ||
|
||
GENEROS = OrderedDict( | ||
[ | ||
("M", "MASCULINO"), | ||
("F", "FEMENINO"), | ||
] | ||
) | ||
|
||
# Nombre de la tabla | ||
__tablename__ = "exh_exhortos_partes" | ||
|
||
# Clave primaria | ||
id = db.Column(db.Integer, primary_key=True) | ||
|
||
# Clave foránea | ||
exh_exhorto_id = db.Column(db.Integer, db.ForeignKey('exh_exhortos.id'), index=True, nullable=False) | ||
exh_exhorto = db.relationship('ExhExhorto', back_populates='exh_exhortos_partes') | ||
|
||
# Columnas | ||
nombre = db.Column(db.String(256), nullable=False) | ||
apellido_paterno = db.Column(db.String(256)) | ||
apellido_materno = db.Column(db.String(256)) | ||
genero = db.Column(db.Enum(*GENEROS, name="tipos_generos", native_enum=False), nullable=True) | ||
es_persona_moral = db.Column(db.Boolean, nullable=False) | ||
tipo_parte = db.Column(db.Integer(), nullable=False, default=0) # 1 = Actor, Promovente, Ofendido; 2 = Demandado, Inculpado, Imputado; 0 = No definido | ||
tipo_parte_nombre = db.Column(db.String(256)) | ||
|
||
def __repr__(self): | ||
"""Representación""" | ||
return f"<ExhExhortoParte {self.nombre}>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
""" | ||
Exh Exhortos Partes, vistas | ||
""" | ||
|
||
import json | ||
from flask import Blueprint, flash, redirect, render_template, request, url_for | ||
from flask_login import current_user, login_required | ||
|
||
from lib.datatables import get_datatable_parameters, output_datatable_json | ||
from lib.safe_string import safe_clave, safe_string | ||
|
||
from plataforma_web.blueprints.bitacoras.models import Bitacora | ||
from plataforma_web.blueprints.modulos.models import Modulo | ||
from plataforma_web.blueprints.permisos.models import Permiso | ||
from plataforma_web.blueprints.usuarios.decorators import permission_required | ||
from plataforma_web.blueprints.exh_exhortos_partes.models import ExhExhortoParte | ||
|
||
MODULO = "EXH EXHORTOS PARTES" | ||
|
||
exh_exhortos_partes = Blueprint("exh_exhortos_partes", __name__, template_folder="templates") | ||
|
||
|
||
@exh_exhortos_partes.before_request | ||
@login_required | ||
@permission_required(MODULO, Permiso.VER) | ||
def before_request(): | ||
"""Permiso por defecto""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters