Skip to content
Discussion options

You must be logged in to vote

It sounds like this is a true or false question: does a given site have any circuits of type X? If so, here's a condition you can use in your link text template to show or hide your link:

{% if obj.circuit_terminations.filter(circuit__type__name='X').count() > 0 %}My Link{% endif %}

You can make this more efficient by finding the circuit type ID you want, and taking '__name' off the end of the query condition. If your type ID is 1:

{% if obj.circuit_terminations.filter(circuit__type=1).count() > 0 %}My Link{% endif %}

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@tux-mania
Comment options

@drmsoffall
Comment options

@tux-mania
Comment options

Answer selected by tux-mania
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants