Re: submit form to the db table with ForeignKey value
On Fri, May 21, 2010 at 6:59 PM, Goran <thegorki@gmail.com> wrote:
[SNIP]
> Region: <select name="region_no">
> <option value="">-- Region --</option>
> {{ region }}
> {% for reg in region %}
> <option>{{ reg }}</option><br/>
> {% endfor %}
> </select><br/>
>
> view after submit form
>
> def newreg(request):
> regog = request.POST['region_no']
>
> no1 = NewReg(region=Region(regog) ) #here i need integer which
> is ID of selected option from database
Are you talking about:
# in your template
<option value="{{ reg.id }}">{{ reg }}</option>
Does works for you?
~Rolando
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home