Tuesday, May 3, 2016

How to access selected options from a select list to show them in a table ?

So i have a select list and a table,and i want to show only the data that corresponds the selected item.

This is my index.html file 

<select title="my_owners">
<option>Owners</option>
<option selected>-------------------</option>
{% for owner in owners %}
<option value="owner"> {{ owner.person_id }} {{ owner.first_name }} {{ owner.last_name }}</option>
{% endfor %}
</select>
<br/> <br/>
<table border="1">
<tr>
<td>Id</td>
<td>Space</td>
<td>City</td>
<td>Street</td>
<td>Price</td>
<td>Purpose</td>
</tr>


{% for info in information %}

<tr>
<td>{{ info.owner_id }}</td>
<td>{{ info.space }}</td>
<td>{{ info.city }}</td>
<td>{{ info.street }}</td>
<td>{{ info.price }}</td>
<td>{{ info.get_purpose }}</td>
{% endfor %}

</tr>

</table>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/e3502e4e-c58b-46e7-8201-9b07edcca7dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment