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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4343a170-b193-4c91-aac4-8d773404353dn%40googlegroups.com.

Reply via email to