I have a form to edit my model. There is a select box in this form. By default there are all the data in this select box. My goal is exclude some data from select box, depending on current item data. So, to achieve my goal, I need to know field value of the current model item in the __init__ method of the field.
class StructureForm(ModelForm): parent = ParentField() class Meta: model = Structure class ParentField(forms.ChoiceField): def __init__(self, *args, **kwargs): kwargs['choices'] = function_to_get_choices(CURRENT_ITEM_FIELD_VALUE) super(ParentField, self).__init__(*args, **kwargs) As you can see, there is a function "function_to_get_choices()" where I have to provide CURRENT_ITEM_FIELD_VALUE and I don't know how to get this value, please H E L P ! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.