I want to fetch the value of radio field for updation but it only doesn't fetch even i use condition and value does comes but doesn't checked

Yametazamwa mara 75
Ruka hadi kwenye ujumbe wa kwanza ambao haujasomwa

Abhinandan K

hayajasomwa,
22 Ago 2022, 02:57:4622/08/2022
kwa django...@googlegroups.com
<label>Email</label>
<input type="email" name="email" value={{datas.email}}>
{% with val_gen=datas.gender%}
{{val_gen}}
<label>gender:</label><br></br>

<input type="radio" name="gender" value="Male"{% if val_gen == Male %} checked{% endif %} >Male</input>
<input type="radio" name="gender" value="Female"{% if val_gen == Female %} checked{% endif %}>Female</input><br><br>
<input type="submit" value="Update">
{% endwith %}
</form>
Screenshot 2022-08-22 at 12.22.54 PM.png

Abdul Qoyyuum

hayajasomwa,
22 Ago 2022, 04:34:5022/08/2022
kwa django...@googlegroups.com
You'll need to use a RadioSelect widget. See example in the link as follows: https://docs.djangoproject.com/en/4.0/ref/forms/widgets/#django.forms.RadioSelect

--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAA6_Mp44RQjMeWfVW82vvT2-GLrv5Jpu2nb_6edWON_3sgXQwQ%40mail.gmail.com.


--
Abdul Qoyyuum Bin Haji Abdul Kadir

Ryan Nowakowski

hayajasomwa,
23 Ago 2022, 09:31:5923/08/2022
kwa django...@googlegroups.com
On Mon, Aug 22, 2022 at 12:26:40PM +0530, Abhinandan K wrote:
> <input type="radio" name="gender" value="Male"{% if val_gen == Male %}
> checked{% endif %} >Male</input>
> <input type="radio" name="gender" value="Female"{% if val_gen == Female %}
> checked{% endif %}>Female</input><br><br>
> <input type="submit" value="Update">

Do you need quotes around Male/Female like this?

Ammar Mohammed

hayajasomwa,
23 Ago 2022, 09:49:5523/08/2022
kwa django...@googlegroups.com

<label>Email</label>


<input type="email" name="email" value={{datas.email}}>


{% with val_gen=datas.gender%}


{{val_gen}}


<label>gender:</label><br></br>

<input type="radio" name="gender" value="Male" {% if val_gen == "Male" %} checked{% endif %} >Male</input> <br>


<input type="radio" name="gender" value="Female" {% if val_gen == "Female" %} checked{% endif %}>Female</input> <br><br>


<input type="submit" value="Update">


{% endwith %}


</form>


--
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.

Mihir Patel

hayajasomwa,
24 Ago 2022, 12:07:1124/08/2022
kwa django...@googlegroups.com
i dont have much idea but try to do with True Or False value bcz maybe it returns boolean value.

--
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...@googlegroups.com.

Godswill King Trace

hayajasomwa,
31 Ago 2022, 09:14:1131/08/2022
kwa django...@googlegroups.com

subin

hayajasomwa,
1 Sep 2022, 14:58:4401/09/2022
kwa django...@googlegroups.com
Thank you for contacting through our website. We’ll follow up with you soon

Jibu wote
Mjibu mchapishaji
Sambaza
Ujumbe 0 mpya