Hello, I'd like to import the variables from view to form, but after trying several ways, I failed.
For example: user01 inputs his username/password(apache authentication) to login, then based on this username, function, get_list_from_ldap, will get a relative list from LDAP. Different username will have different lists. Then I'd variable_from_view can be used as choices of ChoiceField. Anyone knows how I can do it? Any comments will be welcome In from.py from django import forms class ContactForm(forms.Form): email = forms.ChoiceField(choices=variable_from_views) views.py from django.shortcuts import render_to_response from mysite.contact.forms import ContactForm def contact(request): variable_from_views=get_list_from_ldap(user_input_variable) form = ContactForm() return render_to_response('contact_form.html', {'form': form}) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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 -~----------~----~----~----~------~----~------~--~---