It looks like you were on the right track – get_FOO_display()
is most certainly what you want:
In templates, you don’t include ()
in the name of a method. Do the following:
{{ person.get_gender_display }}
More Related Contents:
- django template system, calling a function inside a model
- matching query does not exist Error in Django
- Django foreign key relation in template
- ValueError: invalid literal for int() with base 10:
- Datetime On Django on models?
- What is a “slug” in Django?
- Performing a getattr() style lookup in a django template
- How do I do a not equal in Django queryset filtering?
- Django: add image in an ImageField from image url
- how to iterate through dictionary in a dictionary in django template?
- Django Model Field Default Based Off Another Field in Same Model
- Iterating through two lists in Django templates
- Custom ordering in Django
- Any way to make {% extends ‘…’ %} conditional? – Django
- NoReverseMatch with keyword argument uidb64 with Django 2.0
- Access django models inside of Scrapy
- Django, template context processors
- How do I extend the Django Group model?
- Django values_list vs values
- What is the path that Django uses for locating and loading templates?
- Why doesn’t django’s model.save() call full_clean()?
- “_set” in a queryset object in Django
- Django – form.save() is not creating ModelForm
- What is the best way to access stored procedures in Django’s ORM
- QuerySet, Object has no attribute id – Django
- Identify the changed fields in django post_save signal
- How can I set two primary key fields for my models in Django?
- Django 2.1.3 Error: __init__() takes 1 positional argument but 2 were given
- Django get_profile() method not working on extended User model
- How to delete a record in Django models?