mirror of https://github.com/interlegis/sapl.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
562 B
19 lines
562 B
import inspect
|
|
|
|
from sapl.base.models import Autor
|
|
from sapl.legacy.migracao_dados import appconfs
|
|
|
|
|
|
def getsourcelines(model):
|
|
return [line.rstrip('\n').decode('utf-8')
|
|
for line in inspect.getsourcelines(model)[0]]
|
|
|
|
|
|
def get_models_com_referencia_a(apontado):
|
|
|
|
def tem_referencia_a_autor(model):
|
|
return any(getattr(field, 'related_model', None) == apontado
|
|
for field in model._meta.get_fields())
|
|
|
|
return [model for app in appconfs for model in app.models.values()
|
|
if tem_referencia_a_autor(model)]
|
|
|