Hi, was hoping someone could point me in a direction, I'm somewhat new
to Django.  I'm trying to create a "model of a model", something like
this (mostly pseudo-code, not "real" Python):

class TheModel(Model):
   name
   #some other stuff

class TheModelProperties(Model):
    the_model = ForeignKey(TheModel)
    name
    type
    is_required

That's the meta-model, now I'm going to have "instances" of the model:

class TheThing(Model):
    model = ForeignKey(TheModel)
    title
    #Some Other Stuff

class TheThingProperties(Model):
    the_thing = ForeignKey(TheThing)
    model = ForeignKey(TheModelProperties)
    value

So each TheThing must have one TheModel.  TheModel specifies all the
properties (via TheModelProperties) that are the options for
TheThing.  The values that are selected for these options are stored
in TheThingProperties.

The anticipated usage is that an Admin would create instances of
TheModel and TheModelProperties, using the admin interface (this is
working just fine, of course).  Then, a user would want to create
TheThing using a form.  My idea is that on an initial form, they
select the proper "TheModel", then they would use that to dynamically
create a capture form to not only create a form for TheThing but all
the required TheThingProperties specified by TheModelProperties.

I hope I'm explaining this well.

In any case, I can't for the life of me figure out how to create forms
that are essentially created dynamically based on the contents of the
database.  It seems that if I hack into the form models, I can maybe
do it, but I just wanted to ask this forum if there was a simpler way
that I'm totally missing.

Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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