I'm not a SQL or SQLObject guru - but I think the advice you've got so
far is imperfect.  You need two things: to ensure that the
Beer.shortname is unique for a given Beer.brewery and a way to select a
Beer for a given url.

To ensure uniquness you can create a unique index using (I think):
DatabaseIndex('shortname', 'brewery', unique=True)

To make the selection you can either:
- initially select the Brewery from the database then loop over it's
beers to find the desired one,
- use SQLBuilder to create a SQL query which selects only the result
you want.

The second option is more difficult but, if you've a lot of beers for
each brewery, significantly faster.

Nick

Reply via email to