Hi all,

I am trying to design the following model :
  - a checklist is a collection of checkpoints
  - a checkpoint can be an action, or a group of actions.
  - the same action can be in several groups

I read the Generic relations documentation :
http://www.djangoproject.com/documentation/models/generic_relations/

And also found this thread (but could not extract the essence of it) :
http://groups.google.com/group/django-users/browse_thread/thread/2ca173c9dd57980c/943765855107d2ac

Now, intuitively, I would do this :

        class Checklist(models.Model):
                description = models.CharField(max_length=512)
                def __unicode__(self):
                        return self.description

        class Checkpoint(models.Model):
                list = models.ForeignKey(Checklist, null=True)
                content_object = generic.GenericForeignKey()
                class Meta:
                        abstract = True

        class Action(Checkpoint):
                documentation   = models.CharField(max_length=512)

        class ActionGroup(Checkpoint):
                actions = models.ManyToManyField(Action)

Is this relevant and djangonic ?
I would like to confirm this before struggling with automatic admin,
inlines, jquery etc.

Thank you for your support !

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to