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.

Advertisements

2 thoughts on “Django — How to get only the data from a form field

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s