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 = Costo exclude = ('user', ) def __init__(self, *args, **kwargs): super(CostoForm, self).__init__(*args, **kwargs) self.helper = FormHelper() self.helper.form_tag = False self.helper.form_action = '' self.helper.form_class = 'form-inline' self.helper.template = 'crispy_template/table_inline_formset.html' self.helper.layout = Layout( Field('DELETE', css_class='btn btn-primary') ) self.helper.add_input(Submit('submit', _('Aceptar'))) self.fields['destination'].widget.attrs['readonly'] = True -- 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 post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/21bbfb83-7986-40d7-a2b7-e6208ca857b4%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.