Hi,
Thanks for your support below are the views and models, plz guide, no errors but no success Views.py (cmonth is none value and excluded in form) month is insertable from form template def insert(request): form=StudentForm() if request.method=="POST": form=StudentForm(request.POST) cmonth=request.GET.get('month') if form.is_valid(): form.save() return redirect('/home1') return render(request,'enroll/insert.html',{'form':form}) ------------------------------------------------------------------------------------------------------ Models.py class student(models.Model): month = models.CharField(max_length=64, choices=COLOR_CHOICES, default='plz') cmonth=models.CharField(max_length=64) name= models.CharField(max_length=64) salary= models.CharField(max_length=64) #def student(month = request.GET['value'], cmonth=cmonth) def fm(request): fm =student.objects.create(month=request.GET['month'],cmonth=cmonth) --------------------------------------------------------------------------------------------------------------------- cid:image001.jpg@01D814B5.8DB7AAD0 ---------------------------------------------------------------------------------- Here I want CMonth data from Month cid:image002.jpg@01D814B5.8DB7AAD0 From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Ammar Mohammed Sent: 29 January 2022 01:32 To: 'Rahul Chauhan' via Django users Subject: 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.r...@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+unsubscr...@googlegroups.com <https://mailto:django-users+unsubscr...@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 <https://groups.google.com/d/msgid/django-users/61f44948.1c69fb81.9ac1a.ad93%40mx.google.com?utm_medium=email&utm_source=footer> . -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/51d615fc-43dd-4250-8d04-101c06ad3bf8%40Spark <https://groups.google.com/d/msgid/django-users/51d615fc-43dd-4250-8d04-101c06ad3bf8%40Spark?utm_medium=email&utm_source=footer> . -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/61f4656c.1c69fb81.f300.d6d5%40mx.google.com.