Hi

I would like to put some data from view to form when I create it.
Standard way is to use __init__ metod, but after using __init__ in
form class,
form stop working.

Pleas what I'am doing wrong?


Fragments of example

----------------- view -------------------------
def MyView(request):
    form = MyForm("value")
    return render_to_response('MyTemplate.html', {'form': form})


----------------- form -------------------------
class MyForm(forms.Form):
   item = forms.BooleanField()

   def __init__(self, someArg):
        self.someArg=someArg


----------------- template -------------------------

<h1>MyTemplate</h1>
    <form action="." method="POST">
        <table>
            {{ form.as_table }}
        </table>
        <p><input type="submit" value="Submit"></p>
    </form>


--------- Result in page (show source in browser)----------
<h1>MyTemplate</h1>
    <form action="." method="POST">
        <table>

        </table>
        <p><input type="submit" value="Submit"></p>
    </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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to