Am 12.12.2010 16:33, schrieb Jacek Kałucki:
> Użytkownik Sibylle Koczian napisał:
>> Here they are, for the reccat table (do you need the others?):
>>
>> class BizCategoriesForRecipe(dabo.biz.dBizobj):
>>
>>      def initProperties(self):
>>              self.DataSource = "reccat"
>>              self.KeyField = "recid, catid"
>>              self.LinkField = "recid"
>>              self.AutoPopulatePK = False
>>
>>
>> I didn't set ParentLinkField, because the LinkField references the
>> primary key in the parent table.
>>
>>
>
> Now, you see, since bizobj can have only one parent,
> only first key field is set automatically from the parent.
> Second key field you should update in onNew() method by yourself.
>

The second key field is set here, in BizCategoriesForRecipe:

def addLink(self, catid):
        print "addLink, catid = %d" % catid
        if self.hasLink(catid):
                raise ValueError("Category %d already linked to this recipe" % 
catid)
        self.new()
        self.Record.catid = catid
        self.save()
                
And this is the place where the database gets an UPDATE command, not 
INSERT as it should.

All the code is here: http://dabo.codepad.org/X0tRUmVv

Greetings,
Sibylle
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/[email protected]

Reply via email to