MY models.py
class Forms_in_Document(models.Model):
document_submit = models.ForeignKey(Document_submit, on_delete=models.CASCADE)
class Document_data(models.Model):
forms_in_document = models.ForeignKey(Forms_in_Document, on_delete=models.CASCADE)
document_structure = models.ForeignKey(DocumentStructure , on_delete=models.CASCADE)
date_created= models.DateTimeField(default=datetime.now(),null=False)
string = models.CharField(null=True, max_length=100)
integer = models.IntegerField(null=True)
date_time = models.DateTimeField(null=True)
class Application(models.Model):
user = models.ForeignKey(User,on_delete=models.CASCADE, null=False)
date_created = models.DateTimeField(default=datetime.now(),null=False)
forms_in_document = models.ForeignKey(Forms_in_Document, on_delete=models.CASCADE, null=True)
closed = models.BooleanField(default=False, null=False)
new = models.BooleanField(null=False)
media = models.BooleanField(default=True)
Path_info = models.ForeignKey(Path_info, on_delete=models.SET_NULL,null=True)
Необработанный SQL запрос, который я пытаюсь выполнить в Django views.py, равен
Select * from Application app
inner join Document_data dd
on dd.forms_in_document=app.forms_in_document
Как мне выполнить то же самое, используя Django queryset на мой взгляд?
Заранее спасибо