Thinking like a database developer.. the first thing I would do is make
3 tables to accuratly define the solution.

a Member table
an Appearance table
a many to many join table between the two

This can be done in SQLObject by:

class Member(SQLObject):
   appearance = RelatedJoin('Appearance)*
   ...

class Appearance(SQLObject):
  name = UnicodeCol(length=20, alternateID='True')
  description = UnicodeCol(length=100)
  member = RelatedJoin('Member')*

(*)The presence of the two related joins will create the
member_appearance table which will join the two.

What this will allow is for you to set values simply by adding new
appearances for a member.
app = Appearance.byName('hottie')

joe = Member.byName('Joe')

joe.addAppearance(app)

So the if the user selects an appearance that appearance is associated
with him in the table. If it is left unchecked, then it is not in the
table and therefore false.

The web interface would be a snap.. all you need to do is select all of
the appearances from the Appearance table and create a list of
checkboxes, and the name='' would be the name of the appearance. For
each checked appearance you receive... simply add that one for the
member as defined above.

And to retrieve those appearances on a per member basis, simply grab
apears  = joe.appearances


and voila! an elegant solution that is very easy to extend and manage.

Reply via email to