Cannot resolve keyword '' into field. Choices are:...
|Reported by:||srnsht@…||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I am having this weird problem accessing ManyToManyField.
I have following models.
title = models.CharField(max_length = 200)
url = models.URLField(unique = True)
tags = models.ManyToManyField(Tag)
creation_date = models.DateTimeField(auto_now_add = True)
user = models.ForeignKey(User)
likes = models.ManyToManyField(User, related_name = "%(app_label)s_%(class)s_user_likes")
dis_likes = models.ManyToManyField(User, related_name = "%(app_label)s_%(class)s_user_dis_likes")
abstract = True
preview_image = models.URLField()
preview_heading = models.CharField(max_length = 100)
preview_content = models.CharField(max_length = 100)
When I try to access URL.objects.get(pk=1).likes.all(), I get Cannot resolve keyword into field. Choices are:... error.
URL.objects.get(pk=1).tags.all(), URL.objects.get(pk=1).user and URL.objects.filter(likes=auser, pk=1) work fine.
The fields likes and dis_likes were added using south through schemamigration
Previously I was using Django 1.6.1, updated to Django 1.6.2, the problem still persists
Truncated the database, synced it to have fresh tables, the problem still persists
Change History (3)
comment:1 Changed 2 years ago by anonymous
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Resolution set to fixed
- Status changed from new to closed
comment:2 Changed 2 years ago by mjtamlyn
- Resolution fixed deleted
- Status changed from closed to new