Hi Farhan,

I can think of two ways. Either, like you said during form instantiation, 
do something like this:

class DeleteUserForm(forms.Form):
    def __init__(self, data=None, choices=None, more_info=None):
        super(DeleteUserForm, self).__init__(data)
        widget = forms.MultipleSelect if more_info else forms.Select
        self.fields['del_user_id'] = forms.CharField(label='User', widget=
widget, choices=choices)
        self.fields['something_else'] = forms.IntegerField(min_value=
something, max_value=something_else)

Or, in your view:

def myview(self):
    choices = something
    widget = something
    min_value = etc
    class DeleteUserForm(forms.Form):
        del_user_id = forms.CharField(label='User', widget=widget, choices=
choices)
        something_else = forms.IntegerField(min_value=something, max_value=
something_else)
    form = DeleteUserForm()
    if request.method ==  'POST':
        form = DeleteUserForm(request.POST)
    # etc

Collin

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/57073dbd-f69f-420d-93f7-05c74079b766%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to