У меня есть 2 модели, которые не связаны (возможно, это должно ...)
Мне нужно сделать запрос, чтобы выбрать все записи моей таблицы Фондовая С соответствующими строками в Parametrage на основе asp_sto_loc = asp_par_lo c
Что-то вроде SQL:
select * из оставленного pha_asp_sto объединения pha_asp_par в pha_asp_par.asp_par_loc = asp_sto 1012 *
Как сделать такой запрос в Django?
models.py
class Stock(models.Model):
asp_sto_cle = models.AutoField(primary_key=True)
asp_sto_loc = models.CharField("Site concerned", max_length=10, null=True, blank=True)
asp_sto_pla = models.IntegerField("Quantity of placebos available", null=True, blank=True,)
asp_sto_asp = models.IntegerField("Quantity of aspirin available", null=True, blank=True)
class Parametrage(models.Model):
asp_par_cle = models.AutoField(primary_key=True)
asp_par_loc = models.CharField("Site concerned by settings", max_length=10, null=True, blank=True)
asp_par_ale = models.IntegerField("Site alert value for the site", null=True, blank=True,)
asp_par_con = models.IntegerField("Site confort value for the site", null=True, blank=True,)