__empty=False filter not working / filter on cabled front ports in Export Templates #15350
-
|
I'm trying to filter cabled / non cabled Device Front Ports in an Export Template. This works for front ports without a cable: {% for server in queryset %}
{%- for port in server.frontports.filter(cable_id=None) -%}Filtering ports with a cable, this seems to work, but leaves me with a nagging feeling that I really should be testing for not None (but how ?): {%- for port in server.frontports.filter(cable_id__gt=-1) -%}I tried this instead, but I'm getting this error: {%- for port in server.frontports.filter(cable_id__empty=False) -%}Does anyone know if using As an aside, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
https://docs.djangoproject.com/en/4.2/ref/models/querysets/#field-lookups Looks like |
Beta Was this translation helpful? Give feedback.
https://docs.djangoproject.com/en/4.2/ref/models/querysets/#field-lookups
https://docs.djangoproject.com/en/4.2/ref/models/querysets/#isnull
Looks like
cable_id__isnull=Falseis likely to be the answer.