Tuesday, June 24, 2014

Django wizard with one to many

Hi there,

I need to create a wizard that has an one-to-many relationship on step 2.

These are my models:

class Ticket(models.Model):
    user = models.ForeignKey(User)
    modality = models.CharField(max_length=3)
    drawing = models.ForeignKey(Drawing)
    type = models.CharField(max_length=1, choices=TYPES)
    amount = models.DecimalField(max_digits=6, decimal_places=2)
    first_to_fifth = models.BooleanField(default=False)
    created_at = models.DateTimeField()

    class Meta:
        db_table = 'ticket'


class TicketPick(models.Model):
    ticket_id = models.ForeignKey(Ticket, related_name='picks')
    pick = models.CharField(max_length=4)

    class Meta:
        db_table = 'ticket_pick'

Second step can have up to 5 fields, is possible to do that using Django wizard?

Cheers

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2bb479eb-5df5-410d-b578-bdf15ed8625c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment