Customize CheckboxSelectMultiple

2009-04-09 Thread lbologn...@gmail.com

Hi all,

in my form i have a CheckboxSelectMultiple field and would like to
display a different image next to each checkbox.

How would i do that?

Thanks,
Lorenzo
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: FormWizard accessing previous fields data

2009-02-02 Thread lbologn...@gmail.com

On Feb 3, 12:17 am, Johan Liseborn  wrote:

> Thus, you could do something like (no changes to get_template):
>
> class EnrollWizard(FormWizard):
>     def process_step(self, request, form, step):
>        if step == 0:
>           self.extra_context['foo'] = form.cleaned_data['foo']
>        elif step == 1:
>           self.extra_context['bar'] = form.cleaned_data['bar']
>        elif step == 3:
>           self.extra_context['baz'] = form.cleaned_data['baz']
>
> Now, in each template you will have access to more and more additional  
> information, just like so:
>
> {{ foo }}

Good solution, i like it!

Thanks,
Lorenzo
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: FormWizard accessing previous fields data

2009-02-02 Thread lbologn...@gmail.com

On Feb 1, 2:38 am, "mattimust...@gmail.com" 
wrote:

> I never understood the logic of it either. I also expected to be able
> to do  something like {{previous_fields.firstname }}.

Found it!

class EnrollWizard(FormWizard):

def get_template(self, step):
return 'enroll_wizard_%s.html' % step

def process_step(self, request, form, current_step):

if current_step == 3:
form0 = self.get_form(0, request.POST)
form1 = self.get_form(1, request.POST)
form2 = self.get_form(2, request.POST)

context = (dict(form0=form0, form1=form1, form2=form2))

return render_to_response(self.get_template(self.step),
context)

And then in the template to display a summary i play with ifequal

  {%ifequal form0.course 2%}
  Intensive course
  {%endif%}

  {%ifequal form0.course 1%}
  Standard course
  {%endif%}

If anybody has a more elegant solution i'm all ears!

Thanks,
Lorenzo
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: FormWizard accessing previous fields data

2009-01-31 Thread lbologn...@gmail.com

On Jan 29, 11:31 pm, "lbologn...@gmail.com" 
wrote:
> Hi all,
>
> say i have aFormWizardof 5 steps and at the last step i want to
> display a summary of the submitted data how do i access the value of a
> field that was in the form at step 1?

Maybe i didn't express myself well enough.

My problem is accessing previous steps fields in the template.
Something like a classic {{form.foo}} doesn't work because previous
fields are passed on to the next step as raw html and they're all
contained in {{form.previous_fields}}

My wizard is like 5 steps and on step 1 the user is asked firstname
and lastname on a form. At step 5 i want to display a summary of
submitted info like:

Fistname: John
Lastname: Doe

but i can't simply do {{form.firstname}}

Thanks,
Lorenzo
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



FormWizard accessing previous fields data

2009-01-29 Thread lbologn...@gmail.com

Hi all,

say i have a FormWizard of 5 steps and at the last step i want to
display a summary of the submitted data how do i access the value of a
field that was in the form at step 1?

example:

class Step1(Form):
  foo = CharField()
  bar = CharField()

So at step 5 i'd like to display the value of Step1.foo.

Thanks,
Lorenzo
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---