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

#views.py
def my_action(request):
    credit_app_form = CreditApplicationForm(LANGUAGE_CODE)
    return render_to_response('template.html', {'form' : form})

Thoughts?
Brandon

On Nov 13, 9:54 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Thu, 2008-11-13 at 18:06 -0800, Brandon Taylor wrote:
> > Hi everyone,
>
> > I'm doing an internationalization project and have a form with fields
> > that need to be localized. I would like to have one form, pass in the
> > language code and exclude the appropriate fields.
>
> > How would I go about passing in the variable to the form? I know I
> > have to pick it up in the __init__ of the form, just don't know the
> > correct syntax to do so.
>
> You subclass the Form object anyway, so you need to write an __init__
> method that also accepts this extra parameter. Then you pass in the
> extra parameter to the form yourself whenever you instantiate the form.
>
> Forms are just Python classes. So you customise them like any normal
> class. Django isn't going to do anything special to help or hinder you
> there.
>
> 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to