#22249 closed Bug (worksforme)

Cannot resolve keyword '' into field. Choices are:...

Reported by: srnsht@… Owned by: nobody
Component: contrib.auth Version: 1.6
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I am having this weird problem accessing ManyToManyField.

I have following models.

class Link(models.Model):

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")

class Meta:

abstract = True

class URL(Link):

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.

Updates:

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 17 months 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 17 months ago by mjtamlyn

  • Resolution fixed deleted
  • Status changed from closed to new

Doesn't look like this has been fixed? I haven't verified the OP's comment is a real problem though.

comment:3 Changed 17 months ago by bmispelon

  • Resolution set to worksforme
  • Status changed from new to closed

Hi,

Using the provided models (I also defined an empty Tag model and I assumed User referred to auth.User), I cannot reproduce the issue.

I tried both on master and on 1.6.

Could you provide more information on how you're able to trigger this error?
Thanks.

Note: See TracTickets for help on using tickets.
Back to Top