Friday, January 28, 2022

Re: copy value from field1 to field2

Hello,

i think this is easy. When customer submit post data to django and form is valid. then you make following.

formentry = form.save(commit=False)    formentry.field2 = formentry.cleaned_data['field1']    formentry.save()

This is untested but i am very sure that this works....

Regards

Am Fr., 28. Jan. 2022 um 20:51 Uhr schrieb Feroz Ahmed <feroz.resh@gmail.com>:

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.

--
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/CAKGT9mwczssa%3D%3DP%3Dxp8rC2cbwkQx%3DoRb%2BRXHGc_NfQOd05824Q%40mail.gmail.com.

No comments:

Post a Comment