Thanks Malcom, I'll give that a shot. Cheers, Brandon
On Nov 13, 10:47 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Thu, 2008-11-13 at 20:36 -0800, Brandon Taylor wrote: > > Hi Malcom, > > > This is what I have so far, but is not working... > > > #forms.py > > class CreditApplicationForm(forms.Form): > > def __init__(language_code, *args, **kwargs): > > super(CreditApplicationForm, self).__init__(*args, **kwargs) > > > class Meta(): > > #trying to call self.language_code here returns an exception: > > self is not defined > > That's correct. The inner class (which shouldn't have the parentheses, > btw, since it's a class, not an instance) is parsed at import time, not > runtime. You will need to make changes to the internal setup inside > __init__, since it's per-instance changes. > > > > > #views.py > > def my_action(request): > > credit_app_form = CreditApplicationForm(LANGUAGE_CODE) > > Since the first positional argument to a form is not the language code, > this will almost certainly fail. If you're extending a parent class, > it's usually a lot better to use keyword arguments. Then pop your > keyword arguments from **kwargs before passing the result to the super() > method. > > Regards, > Malcolm --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---