Hello,
I'm buiding a website where users hae t fill a form. It's not a really
big one but I like to split it on multiple pages.

I can build the database with only one big table but I prefer for
update (index) reason split in 3 or 4 tables.

(Maybe you'll find some quetions like beginners one ... it's normal,
I'm a beginner).

Here is an extract of my models.py:
---------------------------------------------------------
class Customer (models.Model):
    email = models.EmailField(max_length=255, unique=True)
    date_inscription = models.DateTimeField(auto_now_add=True)
    date_modification = models.DateTimeField(auto_now=True)
    telephone = models.CharField(max_length=14, blank=True)

class CustomerForm(ModelForm):
    class Meta:
        model = Customer

class CoordonneeDomicile (models.Model):
    customer = models.ForeignKey('Customer')
    adresse = models.CharField(max_length=255, blank=True)
    cp = models.CharField(max_length=5)
    ville = models.CharField(max_length=255)
    pays = models.CharField(max_length=128, default='France')

class CoordonneeDomicileForm(ModelForm):
    class Meta:
        model = CoordonneeDomicile
---------------------------------------------------------

urls.py:
---------------------------------------------------------
from clients.models import CustomerForm, CoordonneeDomicileForm
from clients.views import InscriptionWizard

(r'^clients/$', InscriptionWizard.as_view([CustomerForm,
CoordonneeDomicileForm])),
---------------------------------------------------------

views.py
---------------------------------------------------------
class InscriptionWizard(SessionWizardView):
    def done(self, form_list, **kwargs):
        return render_to_response('done.html', {
            'form_data': [form.cleaned_data for form in form_list],
        })
---------------------------------------------------------

FIrst, I'm not sure of the "customer = models.ForeignKey('Customer')"
in the "CoordonneeDomicile" class. I just want this field to be the
link between the two tables. I don't want a drop down menu be
generated by the formwizard in the step 2.

Is this one the good way to do things or maybe do I have to put all
datas in one table and use partial forms for each step ?

Maybe is there another way of doing things.

All comments are welcome.

Regards

Alain

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