I'm not shure how to reproduce this, may I see your models? How are the two table related?
OK, here's the first table model:
class Article(BaseClass):
title = StringCol()
summary = StringCol()
content = StringCol()
date = DateTimeCol(default=datetime.datetime.now())
categories = RelatedJoin('Category')
Here's Category:
class Category(SQLObject):
name = StringCol(alternateID=True)
icon = StringCol()
articles = RelatedJoin("Article")
pages = RelatedJoin('Page')
And, since Article is based off of "BaseClass", here it is for completness:
class BaseClass(SQLObject):
def DateStr(self):
return(self.date.strftime("%A, %d %B, %Y %H:%M"))
def ShortDate(self):
return(self.date.strftime("%m/%d/%y %H:%M:%S"))
BaseClass is just a class that has some built-in date-related stuff so I don't have to do all that tedious mucking about with it in my templates, etc. Should be harmless ...
Anyway, so create a few "article" classes in Catwalk, and a few categories. Link articles to Categories.
Then delete one of the articles. (id 2 in my case).
Then create a new one.
Then try to link this new "Article" to one or more categories.
At this point, an exception is raised and it ends with:
SQLObjectNotFound: The object Article by the ID 2 does not exist
I went and looked at my article_category table directly through pgAdmin (the PostgreSQL administrative client for Windows, very nice tool) and found that the relationship between Article #2 and its categories was still in place. Once I deleted it manually through pgAdmin, everything was good.
The more I think about it the more I wonder if it's an sqlobject issue, but you're in a better position than I to say at this point.
Anything else you need, don't hesitate to ask.
--
"Things fall apart. The Center cannot hold."
- Life as a QA geek, in a nutshell.
Best,
Jeff

