Why not use Form Wizard from django.contrib.formtools.
Look at
https://docs.djangoproject.com/en/dev/ref/contrib/formtools/form-wizard/#conditionally-view-skip-specific-steps
Simply change show_message_form_condition method to something like

def show_message_form_condition(wizard):
    cleaned_data = wizard.get_cleaned_data_for_step('0') or {}
    return cleaned_data.get('sender', '') in ['adm...@example.com',
'specialu...@example.com']




2012/7/10 Leandro Alves <ldal...@gmail.com>

> Hi,
>
> I'm new in Django and I'm struggling myself here to find out how to get
> the value of a field inside the forms.py.
> Yes, I did read the documentation, keep reading and searching on the
> internet... But please, could someone give a tip regarding this?
>
> I just want to get/use the values of the fields from ContactForm1 into
> ContactForm2? Is that possible?
>
> I know that in the views.py, we can get it from the "cleaned_data"... but
> how in the forms.py?
>
> from django import forms
>
> class ContactForm1(forms.Form):
>     subject = forms.CharField(max_length=**100)
>     sender = forms.EmailField()
>
> class ContactForm2(forms.Form):
>     message = forms.CharField(widget=forms.**Textarea)
>
> For example I want to be able to use the value of the "sender" inside the
> ContactForm2, showing the message box just for some specific senders...
>
> Please anyone with a simple tip?
>
> Thanks in advance,
>
> Leandro
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/v_d4gPDBOy4J.
> 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.
>

-- 
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.

Reply via email to