Friday, January 28, 2022

Re: copy value from field1 to field2

Hello 
You can do it in your views.py 
#If request method is get you can use 
val2 = request.GET.get('val1') 
#if method is get you can use 
val2 = request.POST.get('val1')

#then you can use val2 to in sert it in the dB 
Model.objects.create(val1=request.GET['val1'], val2=val2) 

Regards 

Ammar Mohammed
Tel: 249113075979
On 28 Jan 2022, 21:52 +0200, Feroz Ahmed <feroz.resh@gmail.com>, wrote:
Hi,
I am new to django,
I have field1 as dropdown with mentioned months name
filed2 is none and excluded in forms
 
I want while inserting the data , if I select month , it should insert the same value in field2
 
request your support
Ex:
field1 .value('JAN')
 
field2 is excluded from froms.py
want the value to be inserted in field2  from field 1 in db
 
update / delete /insert functions are fine, no issues  but field2 is not getting value from field 1 Thank You --
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/61f44948.1c69fb81.9ac1a.ad93%40mx.google.com.

No comments:

Post a Comment