|
19 | 19 | from db.base import Base, AutoBaseMixin, ReleaseMixin, lexicon_term |
20 | 20 |
|
21 | 21 | if TYPE_CHECKING: |
22 | | - from db.thing import Thing |
23 | | - from db.location import Location |
| 22 | + pass |
24 | 23 |
|
25 | 24 |
|
26 | 25 | class Notes(Base, AutoBaseMixin, ReleaseMixin): |
@@ -50,16 +49,16 @@ class Notes(Base, AutoBaseMixin, ReleaseMixin): |
50 | 49 |
|
51 | 50 | # --- Polymorphic Parent Relationships (Internal) --- |
52 | 51 | # These are viewonly relationships used by the 'target' property below. |
53 | | - _thing_target: Mapped["Thing"] = relationship( |
54 | | - "Thing", |
55 | | - primaryjoin="and_(foreign(Notes.target_id) == Thing.id, Notes.target_table == 'thing')", |
56 | | - viewonly=True, |
57 | | - ) |
58 | | - _location_target: Mapped["Location"] = relationship( |
59 | | - "Location", |
60 | | - primaryjoin="and_(foreign(Notes.target_id) == Location.id, Notes.target_table == 'location')", |
61 | | - viewonly=True, |
62 | | - ) |
| 52 | + # _thing_target: Mapped["Thing"] = relationship( |
| 53 | + # "Thing", |
| 54 | + # primaryjoin="and_(foreign(Notes.target_id) == Thing.id, Notes.target_table == 'thing')", |
| 55 | + # viewonly=True, |
| 56 | + # ) |
| 57 | + # _location_target: Mapped["Location"] = relationship( |
| 58 | + # "Location", |
| 59 | + # primaryjoin="and_(foreign(Notes.target_id) == Location.id, Notes.target_table == 'location')", |
| 60 | + # viewonly=True, |
| 61 | + # ) |
63 | 62 |
|
64 | 63 | @property |
65 | 64 | def target(self): |
@@ -102,6 +101,7 @@ def notes(cls): |
102 | 101 | ), |
103 | 102 | cascade="all, delete-orphan", |
104 | 103 | lazy="selectin", |
| 104 | + overlaps="notes", |
105 | 105 | ) |
106 | 106 |
|
107 | 107 | def add_note( |
|
0 commit comments