Django 1.8 - FieldError: Cannot resolve keyword into field
What if you set a related_name
on the `ForeignKey ?
class Page(models.Model):
site = models.ForeignKey('Site', related_name="pages") # Note the related_name here
I tried it on another project and it work as axpected:
>>> Site.objects.filter(pages__pk=42)
[<Site: http://stackoverflow.com>]
If you don't set a related_name
, I think the default is <model>_set
. So it should be page_set
.