I have a particular scenario that I can't seem to figure out how to
accomplish in Django.

I have the following models: -

class Process(models.Model):
    name = models.CharField(max_length=50)
    is_active = models.BooleanField(db_index=True)

class Phase(models.Model):
    name = models.CharField(max_length=50)
    is_active = models.BooleanField(db_index=True)

class ProcessPhase(models.Model):
    process = models.ForeignKey(Process)
    phase = models.ForeignKey(Phase)
    order = models.PositiveIntegerField(help_text="At what step of
your process will this phase occur?", unique=True)
    class Meta:
        ordering = ['order']
        unique_together = (("recruitment", "phase"),)

Here an instance of Process can have many instances of Phases, and
each Phase in a Process needs to be completed in the order specified.
Different Processes may have their phases in different order, this is
why the order is specified as part of the ProcessPhase model instead
of the Phase model.

I am having difficulty in implementing the creation of ProcessPhase in
the UI. Ideally the user would be able to select all the phases that
need to be included in a given Process and specify their respective
orders in a single "screen/page". (This is required also because in
the ProcessPhase model, the order field has unique=True.)

Right now I have a ModelMultipleChoiceField for phases so that the
user may choose the phases that need to be included. I then use a
second form (a formset really) to allow the user to specify the
desired order for the selected phases. Then I tried to make it more
intuitive for the user so that they do not have to go through two
different forms to achieve the end result, so I explored the
FormWizard. However, it seems the FormWizard does not support using
formsets in its steps.

So how would you implement this in Django?
--~--~---------~--~----~------------~-------~--~----~
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