i have several files names like: mod1.py, mod2.py, mod3.py, etc. consist of unique models , fields.
mod1.py:
from django.db import models class report(models.model): text = models.textfield() ...
models.py:
import random.random id_part = random(1,10) __import__('apps.reports.mod%s' % id_part)
when try import
it, class not found.
from models import report
is possible add model in model file variable name?
the problem models aren't imported in scope of models.py
need somehow implement from foo import *
dynamically. here can find solution (not elegant).
anyway it's strange approach.
Comments
Post a Comment