Sunday, July 24, 2016

Re: Django selected value


> I signed value/name as variants. Problem is i can`t get any of these- value of selected item and name of selected item.
> I was try:
> Model2.objects.order_by('choice_field')
> Model2.objects.values('choice_field')
> Model2.objects.values_list('choice_field')
> Model2.objects.all()
>
> I can`t get - as value of selected item - such as name of selected  item
> When i save model - selected item saved and I see selected item in drop box. How to get anything from this drop box  instead {'choice_field': 5}?
> Now I try all queryset methods - on this time - nothing.

I'm confused about what you are trying to accomplish.

Are you trying to get the name of a field within the template after the user makes a selection but before they submit?

Are you trying to see something within the view after they submit? Do you want the name (field identifier), display value (what the user sees), or the value they selected?

The view you provided is incomplete at best. Please provide the view and template you are working with.

-James

--
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/CA%2Be%2BciX2N1bzAh18NhjyYrCWtNqSrSpf0pdBeLcOCSyseOh93A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment