Is there any way to get the id of a field in a template?
In the HTML I get:
I know I can g
This doesn't work for every form field.
For instance {{ form.address.auto_id }}
works while {{ form.address.auto_name }}
will not.
However you can use {{ form.address.html_name }}
to get the equivalent answer.
Here are the docs
You can get the ID like this:
{{ field.auto_id }}
You can also use id_for_label:
{{ field.id_for_label }}
In Django 2 you can retrieve the ID for a specific field using {{ field.id_for_label }}
This is documented here.