Re: Passing initial values to a form

2013-09-01 Thread Drew Ferguson
Perfect, thanks On Sun, 1 Sep 2013 18:44:07 +0200 Thomas Orozco wrote: > The URL parameter (iid) is accessible in your view in self.kwargs["iid"]. > > You can pass it to the form by overriding your view's `get_initial` > method > ( https://github.com/django/django/blob/1.6b2/django/views/generi

Re: Passing initial values to a form

2013-09-01 Thread Thomas Orozco
The URL parameter (iid) is accessible in your view in self.kwargs["iid"]. You can pass it to the form by overriding your view's `get_initial` method ( https://github.com/django/django/blob/1.6b2/django/views/generic/edit.py#L22 ) `get_initial` should return a dict, and you should use: { 'na

Passing initial values to a form

2013-09-01 Thread Drew Ferguson
Hi I have gotten myself badly confused today trying to figure this out. If I have these elements # urls.py url(r'^banker/(?P\d+)/iac$', view = IacCreateView.as_view()) # views.py class IacCreateView(LoginRequiredMixin, CreateView): template_name = 'iaccount_form.html' model = Iaccount