Hi, I'm novice with django and I use simple form with select option method. Options come from db and it works fine. When user submit form i have selected option as string and can not save it to db because this table is models.ForeighKey(AnotherTable) and I need ID of selected option to pass it to the new db table "something=TableName(int)" Is there some method to get id of selected option instead of selected option name or I must to create new db request to get id of selected option in view.py before i can save it.
view dajreg = Region.objects.all() return render_to_response( 'page.html' , { ' region ' : dajreg } ) form template 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 -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.