hi,

i am looking for an advice concerning django's forms and formsets.

i am creating a ticket system where the assignees and tickets are
associated via an intermediary table/model.

that's what the models basically looks like:

class Ticket(models.Model):
    title = models.CharField('Titel',max_length=160)
    assigned_to = models.ManyToManyField
('inventory.User',through='TicketAssignees', blank=True, null=True)

class TicketAssignees(models.Model):
    user = models.ForeignKey('inventory.User')
    ticket = models.ForeignKey('tracker.Ticket')
    status = models.CharField
(max_length=1,choices=RoleChoices,blank=False,null=False)

the intermediary table seemed necessary to me, as i want so send
notifications (via signals) when an assignee is added to or removed
from a ticket.

what is the best way to build a form, that allows me to create a new
ticket?
using a standard modelform the 'assigned_to'-field is rendered as a
multiple choice-widget without the extra fields specified in the
intermediary model (status etc.)
okay, so i could build a custom form and add the missing fields
manually.
but does it make sense to include the fields of both models into the
same form?

i thought about creating an AssigneeForm for the TicketAssignees-Model
and tie it to a TicketForm (where i'd exclude the 'assigned_to'-field)
and glue both forms to new formset.
but as i learned, formsets are basically used to create multiple
copies of the same form.

then inline formsets came to my mind (especially as django's admin
allows to add m2m-related data as InlineAdmin) - but they are, as the
docs state, used for related foreign key data and not for related m2m
data.

what options am i overlooking?
the last thing that comes to my mind is the form wizard - but i am
sure there are simpler solutions ...
--~--~---------~--~----~------------~-------~--~----~
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