Hi,
I get a very strange (and not very helpful, at least to a Django
newbie) error message when trying to establish a ManytoOne-relation.
This is what I have:
class Unternehmen(meta.Model):
id = meta.IntegerField(primary_key=1)
# ...
class KeyData(meta.Model):
orga_id = meta.ForeignKey(Unternehmen, db_column='id')
keyd_year = meta.IntegerField()
# ...
id = meta.IntegerField(primary_key=1)
# this causes the error:
the_unternehmen = meta.ManyToOne(unternehmens.Unternehmen, 'id')
This causes the following error (Traceback):
Unhandled exception in thread started by
Traceback (most recent call last):
File
"c:\programme\python\python24\lib\site-packages\django-0.91-py2.4.egg\django\core\management.py",
line 757, in inner_run
validate()
File
"c:\programme\python\python24\lib\site-packages\django-0.91-py2.4.egg\django\core\management.py",
line 741, in validate
num_errors = get_validation_errors(outfile)
File
"c:\programme\python\python24\lib\site-packages\django-0.91-py2.4.egg\django\core\management.py",
line 634, in get_validation_errors
import django.models
File
"c:\programme\python\python24\lib\site-packages\django-0.91-py2.4.egg\django\models\__init__.py",
line 13, in ?
modules = meta.get_installed_model_modules(__all__)
File
"c:\programme\python\python24\lib\site-packages\django-0.91-py2.4.egg\django\core\meta\__init__.py",
line 111, in get_installed_model_modules
mod = __import__('django.models.%s' % submodule, '', '', [''])
File
"D:\vdb-Ostendorf\Django\prod\..\prod\wwe_evus\models\wwe_evus.py",
line
144, in ?
class KeyData(meta.Model):
File
"c:\programme\python\python24\lib\site-packages\django-0.91-py2.4.egg\django\core\meta\__init__.py",
line 699, in __new__
assert callable(v), "%r is an invalid model parameter." % k
AssertionError: 'the_unternehmen' is an invalid model parameter.
The ModelBase __new__ method seems to complain that "the_unternehmen"
is not callable -- but I'm just about to create it... To me, this error
is not understandable at all.
Can please somebody help me? Thanks!
Tobias