Re: Readonly ModelChoiceField of type in model foreignkey

2018-09-19 Thread nelson fernando garcia gomez
to have a select field with 2000 records I want it to be only reading to show me the field to which is linked only reading if I put it in disabled mode I deactivate the ok field to this point well, the bad thing is that putting it this way, the 2000 records are still loaded into the template a

Re: Readonly ModelChoiceField of type in model foreignkey

2018-09-19 Thread nelson fernando garcia gomez
a possible solution I see is to change the field to CharField() type, here is a new problem: the field is printed the pk that is related as then how can I read that pk to show the name and not that pk in the template? El martes, 18 de septiembre de 2018, 13:58:26 (UTC-5), nelson fernando garcia

Re: Readonly ModelChoiceField of type in model foreignkey

2018-09-19 Thread nelson fernando garcia gomez
to have a select field with 2000 records I want it to be only reading to show me the field to which is linked only reading if I put it in disabled mode I deactivate the ok field to this point well, the bad thing is that putting it this way, the 2000 records are still loaded into the template an

Re: Readonly ModelChoiceField of type in model foreignkey

2018-09-19 Thread Mateusz
Sorry but I don't understand. For me, what you say now is that you want the field to be visible but empty (without any data from model in it) or invisible (excluded)? Can you, please, clarify what do you want to achieve? Have you tried appending the lines I gave you, not replacing the last line?

Re: Readonly ModelChoiceField of type in model foreignkey

2018-09-19 Thread nelson fernando garcia gomez
This only disables it but internally it receives data this makes the process of loading the template is the same with disabled enabled or disabled, so it is necessary to use readonly but does not show readonly. El martes, 18 de septiembre de 2018, 19:00:37 (UTC-5), Mateusz escribió: > > (use t

Re: Readonly ModelChoiceField of type in model foreignkey

2018-09-19 Thread nelson fernando garcia gomez
This only disables it but internally it receives data this makes the process of loading the template is the same with disabled enabled or disabled, so it is necessary to use readonly but does not show readonly. El martes, 18 de septiembre de 2018, 19:00:37 (UTC-5), Mateusz escribió: > > (use tr

Re: Readonly ModelChoiceField of type in model foreignkey

2018-09-18 Thread Mateusz
(use traductor si necesita) I hope I understand your question correctly. When in Django 1.8 or 1.9+ you can just do self.fields['destination'].disabled = True in lower versions you should add self.fields['destination'].widget.attrs['disabled'] = True at the end of your __init__(..). W dniu wto

Readonly ModelChoiceField of type in model foreignkey

2018-09-18 Thread nelson fernando garcia gomez
Hola estoy tratando en mi formulario (formsModel) implementar el atributo de *readonly* a una foreignkey (ModelChoiceField) pero no es posible alguna ayuda por favor GRACIAS así lo estoy haciendo: class CostoForm(forms.ModelForm): """ Edicion de Costos con formset. """ class Meta: model = C