why using a foreignkey then? what type of relationship is existing between the supplier and the
On Thu, Jan 12, 2023 at 2:13 PM 'dtdave' via Django users < [email protected]> wrote: > I have the following relationship in a model > > class Contract(models.Model): > supplier = models.ForeignKey( > Supplier, > on_delete=models.CASCADE, > verbose_name="Supplier Name", > related_name="contract_suppliers", > ) > > I am trying to include an if statement in my template but the following > does not work: > {% if contract.supplier == 'IBM' %} > > If I replace this with a non-foreign key item then it works fine. > > Any help would be appreciated. > > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/4343a170-b193-4c91-aac4-8d773404353dn%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/4343a170-b193-4c91-aac4-8d773404353dn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPxt_2WpMVk%2Bzsw_useriH4GfGq0k1O5MisHbObcZ%2BCvR3hw%2Bg%40mail.gmail.com.

