Hi all,

Say I have this simple model:

DayTimesheet
   date: a Date
   entries: a list of TimeEntry

TimeEntry:
   day: a DayTimesheet
   in: a time (HH:MM)
   out: a time (HH:MM)

DayTimesheet is the parent of TimeEntry in a one-to-many relationship.

What would be the best way of ensuring the following:

1. Creating DayTimesheet on demand, i.e.
DayTimesheet.get_by(date=nonexistentdate) would create a new instance
if needed (inserted on the next flush())

and

2. Automatically removing childless DayTimesheet instances - that is,
when the last TimeEntry is deleted from a DayTimesheet, delete the
DayTimesheet too?

Arnar

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to