Hi, I think I may discovered a bug in django, but I'm not sure
[03:19am] The bug is this: 1. You make a ManyToManyField related the same model in wich you are creating the field
[03:20am] Example:
[03:21am] class WhatEver(models.Model):
field = models.ManyToManyField('Whatever', related_name='related_rel_name')
[03:22am] this creates an appname_whatever table and and an appname_whatever_fields table in the database that contains to fields: from_whatever_id and whatever_id
[03:24am] Obviously takes the word from_ in the first field to difference from the second field
[03:24am] The bug:
[03:24am] If I change the field in the model to b.e
field = models.ManyToManyField(AnotherObject, related_name='related_rel_name')
[03:26am] and I make migrations and migrate, the db table field whatever_id changes to anotherobject_id, but the field from_whatever_id remains intact
[03:28am] when you use the relation in your proyect you get an error like "theres no appname_whatever_fields.whatever_id"
[03:28am] I had to rename manually from_whatever_id to whatever_id
[03:28am] Check it, please
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
django-users+unsubscribe@googlegroups.com.
To post to this group, send email to
django-users@googlegroups.com.
Visit this group at
https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/9ff8a220-457c-4801-a84c-8b783a8a0bed%40googlegroups.com.
For more options, visit
https://groups.google.com/d/optout.
No comments:
Post a Comment