I am writing queryset in django. In the first queryset it is working fine. In the second it is giving the error " cannot resolve xyz into a field .. .. "
In models.py
class XYZ(models.Model):
id= models.AutoField(primary_key=True)
name = models.CharField(max_length=200)
addres= models.CharField(max_length=200)
def __unicode__():
return self.name
class ASD(models.Model):
id= models.AutoField(primary_key=True)
pub = models.ForeignKey(XYZ)
city= models,CHarField(max_length=200)
First queryset:
queryset= XYZ.objects.filter(asd__pub____exact='4535344sds3646fhgf7987')
Second queryset:
queryset= ASD.objects.filter(xyz__id____exact='4535344sds3646fhgf7987')
But acccording to django docs it should work.