Django — How to get only the data from a form field

Say you can’t be using {{ form.myfield }} because you need full control over the input tag. All is fine & well except for when your form requires validation and you need initial values set for your fields.

I looked through some tutorials & couldn’t find what I was looking for. Here’s the big secret:

{{ form.myfield.data }} = the value associated with that key.
Enjoy.

2 Comments

  1. Serch says:

    Very handy! Thanks a lot!

  2. Victor says:

    Nice! Helped me a lot.

Leave a reply to Serch Cancel reply