Override the save method in the model. Do the lookup and set the status accordingly. Am I missing something?
Michael Trier blog.michaeltrier.com On Dec 5, 8:26 am, turbofart <[EMAIL PROTECTED]> wrote: > Hi, > > I'm trying to model a simple application. It will consist of 2 models: > > - document > client_number > document_number > document_date > ... (some additional fields) > > - document_status > client_number > document_number > document_date > > status_code > comment > ... (some additional fields) > > I am aware, that django will not allow me to create primary key on > multiple fields (client_number, document_number, document_date), and > will create for each model (table) it's surogate id field as primary > key, I'm OK with that. > > What I would like to achieve, is to add document status, that just > before inserting into db, will find it's parent document's primary > key, by searching in database for those 3 fields (client_number, > document_number, document_date). > > Could you please help me, or at least point the direction I should > follow? > > Best regards, > > -- > turbofart --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---