Hi,
I have the following model
Channels(models.Model):
blogs = models.ForeignKey(‘blogs’, models.DO_NOTHING)
channel = models.ForeignKey(‘channel’, models.DO_NOTHING)
class Blogs(models.Model):
id = models.AutoField(primary_key=True)
date_posted = models.DateTimeField()
title = models.CharField(max_length=255)
attachments = models.ForeignKey(‘attachments’, models.DO_NOTHING)
class Attachments(models.Model):
id = models.AutoField(primary_key=True)
file = models.TextField()
type = models.CharField(max_length=10)
if I write
A = Channels.objects.select_related().filter(channel = 1).order_by(’-blogs.date)
I get data related to table blogs but not related to attachments but when I see query I can Attachments in the query
I get data from the three tables. but I’ not able to add filters from third table (Attachments)
example :
A = Channels.objects.select_related().filter(channel = 1).filter(attachments__type = “jpg”).order_by(’-blogs.date)
Any help on this or direction to right document is very much appreciated