One of our internal clients has asked for a form with the following
structure:
http://ssecdn.net/marcomm_form.pdf

As you can see, there are a lot of checkboxes, and they (the client)
need to be able to add more via the admin.

I initially thought I'd store "Request Types" and "Requests" like
this:

class MarcommRequestType(models.Model):
        name = models.CharField(max_length=255)
        order = models.IntegerField()
        is_active = models.BooleanField(blank=True, default=True)

class MarcommRequest(models.Model):
        request_type = models.ForeignKey('MarcommRequestType')
        name = models.CharField(max_length=255)
        is_active = models.BooleanField(blank=True, default=True)


...and then, store each instance of the form with a ManyToManyField on
MarcommRequest, like this:

class MarcommTicket(models.Model):
        created = models.DateTimeField(auto_now_add=True)
        name = models.CharField(max_length=255)
        department = models.CharField(max_length=255)
        email = models.EmailField()
        date_needed = models.DateTimeField()
        requests = models.ManyToManyField('MarcommRequest')


That works perfectly, except for those questions that have "other" or
"date of event" or things of that sort. As far as I can tell, there's
no good way to have a third level of question to my form, if that
third level is any kind of text entry / non-relationship field.

I thought a possible solution might be to have a "sub question" model
that lets the admin users specify a label and field type, but then,
where do I save the *answers* to the sub-questions?

What's the most Djangonic / Pythonic way to do this type of thing? It
seems like the kind of problem someone might have faced before...

Thanks!
Steven L Smith
Web Developer, Nazareth College

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