django - South Data Migration Fails with ValueError when Function Tries to Access a Table Through a Foreign Key -
django - South Data Migration Fails with ValueError when Function Tries to Access a Table Through a Foreign Key -
my info migration references function takes object of current model parameter, , tries create object table (in same app) through foreign key. creation of object fails value error stating object passed argument not instance of expected class (although is). seems there no link between 2 tables.
here info migration.
ranking in orm.ranking.objects.all(): find_matching_domains(ranking)
find_matching_domains
declared in app , imported in info migration. fails when trying create dictionary object.
dico = categorydict(category=ranking.category, key="url_dict", value=url_dict)
with next error:
file "...", line 175, in save_url_dict value=url_dict) file ".../lib/python2.6/site-packages/django/db/models/base.py", line 355, in __init__ setattr(self, field.name, rel_obj) file ".../lib/python2.6/site-packages/django/db/models/fields/related.py", line 366, in __set__ self.field.name, self.field.rel.to._meta.object_name)) valueerror: cannot assign "<category: category object>": "categorydict.category" must "category" instance.
i have frozen corresponding schemas in migration not have effect.
i utilize django 1.4.3.
actually turns out info migrations not appropriate execute methods project populate database. instead of writing migration have written admin interface method allow execute code admin interface.
django foreign-key-relationship django-south data-migration
Comments
Post a Comment