Alice wrote:

class Answer(meta.Model):
       user = meta.ForeignKey(User)
       question = meta.ForeignKey(Question)
       choice = meta.ForeignKey(Choice)

I just did a double take on my model and realized a composite key would
be more ideal here as I wouldnt want a user answering the same question
twice ...
but I can't find a way of grouping them together into a composite key -
is this possible (or even desirable, looking at some of the previous
posts)?

I'd prefer a database-level rather than an application-level solution
if one exists..

I haven't tried this but in theory:

user = meta.ForeignKey(User,Question,Choice)

?
That at least would be logical considering the actual foreign key syntax on the db side.

Sincerely,

Joshua D. Drake

Reply via email to