Django - Error models with control data

I am working on writing a models.py file and I need some controls to automatically compile some fields.

MOTIVOINGRESSO = ( (u'sequestro ', u'sequestro'), (u'fermo ', u'fermo'), (u'confisca final ', u'confisca final'), (u'cambio custodian ', u'cambio custodian'), ) motivo_ingresso = models.CharField (max_length = 50, choices = MOTIVOINGRESSO) 

FERMO = ( (u'30 ', u'30'), (u'60 ', u'60'), (u'90 ', u'90'), (u'180 ', u'180'), (u'1 month ', u'1 month'), (u'3 months, 'u'3 months'), (u'indeterminato ', u'indeterminato'), ) durata_in_giorni_del_fermo = models.CharField (max_length = 20, choices = STOPPED, blank = True)

If the administrator chooses "sequestro", in durata_in_giorni_del_fermo "indeterminato" will automatically be selected. Should I report entered values? or machine cycles, if in models?

Any ideas?

+3
source share
1 answer

It is very easy if you do it through Jquery in the template. I do not know, this is possible in models.py . The links below are very important for your question.

In the hope that you will understand the idea of ​​ajax and jquery after the following links :)

+2
source

All Articles