1

I have 2 steps in formwizard. the first step is where the customer filled up their particular and the second step is about building particular.

models.py

class customer(models.Model): 
    LAST_NAME   = models.CharField(max_length = 50)
    FIRST_NAME  = models.CharField(max_length = 50)               
    ADDRESS     = models.CharField(max_length = 60, blank =True)

    def __unicode__(self):
        return '{0}' % (self)


class building(models.Model):
    CUSTOMER          = models.ForeignKey(customer, null = True, blank = True)
    BUILDING_USE         = models.CharField(max_length = 2, blank = True, choices = c.Anvendelse, default = '02')
    BUILDING_FLOORSPACE  = models.IntegerField(default=0)

    def __unicode__(self):
        return '{0}' % (self)

forms.py

class customerForm(ModelForm):
    FIRST_NAME      = forms.CharField(max_length=50)
    LAST_NAME       = forms.CharField(max_length=50)  
    ADDRESS         = forms.CharField(max_length=60)


class buildingForm(ModelForm):
    CUSTOMER            = forms.CharField(widget=forms.TextInput)
    BUILDING_FLOORSPACE = forms.CharField(widget=forms.TextInput)
    BUILDING_USE       = forms.CharField(widget=forms.TextInput)


class customerWizard(FormWizard):
    def done(self, request, form_list):
        return render_to_response('done.html', {
            'form_data': [form.cleaned_data for form in form_list],
    })

urls.py

url(r'^contact/$', customerWizard.as_view([customerForm, buildingForm])),

I have actually two templates customer.html and building.html How do I do so that I may be able to use my own template. #1 will be displaying customer.html and #2 displaying building.html. when i do this url it gives me the customer.html but when i submit to go to next step it didn't show the building.html but instead showing the customer.html without style.

wizard.html(customer.html copy to wizard.html) some codes...

<div id="tabs-1">
<p>Step {{ step }} of {{ step_count }}</p>
<form action="." method="post"> 
{% csrf_token %}

 {{ form.id }} 

some codes....

<input type="hidden" name="{{ step_field }}" value="{{ step0 }}" />
{{ previous_fields|safe }}
<input type="submit">
</form>

Help is very very much appreciated......need help badly...kinda trying to figure out all this for 2 days already and every time I do changes then it give me weird error...

Thank you so much in advanced. Sorry for my silly q.

noobes
  • 161
  • 2
  • 18
  • You should take a look at PEP8 when you have some time. http://www.python.org/dev/peps/pep-0008/ –  Mar 13 '13 at 22:43

0 Answers0