I am trying to dynamically generate a form, the fields will vary if the user is logged in. Here is where I am so far
forms.py ====== class LinkForm(ModelForm): def __init__(self, *args, **kw): self.request = kw.pop('request') super(LinkForm, self).__init__(*args, **kw) class Meta: model = Link if self.request.user: exclude = ['ip_address', 'timestamp', 'user', 'method', ] else: exclude = ['ip_address', 'timestamp', 'user', 'method', 'notes', 'private_stats',] views.py ====== def index(request): form = LinkForm(request=request) The error I get makes it clear I don't have access to request within class Meta: NameError at / name 'self' is not defined Thanks, Merrick --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---