Hi all,

I find myself struggling to make a shorter version of  a form. I am a
newb so I apologize in advance for my ignorance. Our web master left
for greener pastures and since I'm the only one with any programming
experience, I have been forced to take over until we hire a
replacement. So…

I added a model to set the form-type to "0" or "1" which corresponds
to "Long form" and "Short form"

When I create a new long form and add the following to the form page
template I get the expected answer:

{{app.workshop.type.get_form_type_display}}  results in "Long form"

I'm trying to use this syntax to write an if statement that shows or
hides an element based on the form_type.  So when I'm in my forms.py
doc I include this:

    if self.workshop.type.form_type == '0':
        home_address = forms.CharField(
                        label="Home Street Address",
                        required=False,
                    )

Self returns the error "not defined".  As does instance, this, etc.

the if statement works as such:

foo = '0'
        if foo == '0':
        home_address = forms.CharField(
                        label="Home Street Address",
                        required=False,
                    )

This code is in a sub class where I'm tying to obtain
"workshop.type.form_type" from the parent class and can't figure out
how to access it.

I have a sinking feeling that the answer is staring me in the face.

Thanks in advance for your help,

Len

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