Changes between Version 56 and Version 57 of ModelInheritance
- Timestamp:
- Apr 30, 2008, 4:35:50 AM (17 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ModelInheritance
v56 v57 1 1 = Model Inheritance = 2 2 3 '''As of 2008, both SQLObject and SQLAlchemy have sound and tested implementations of model inheritance. Whoever is or starts working on this should try to reuse their efforts.''' 3 == Current Status == 4 5 This was implemented into the queryset-refactoring branch that was merged into trunk in changeset r7477. See QuerysetRefactorBranch. 6 7 ''What follows in this page are opinions, notes and ramblings of some individuals regarding this topic collected since Aug. 2005.'' 8 9 == Misc. content == 10 11 As of 2008, both SQLObject and SQLAlchemy have sound and tested implementations of model inheritance. Whoever is or starts working on this should try to reuse their efforts. 4 12 5 13 This is a proposal for how subclassing should work in Django. There are a lot of details to get right, so this proposal should be very specific and detailed. Most of the ideas here come from the thread linked below: … … 11 19 [http://groups.google.com/group/django-developers/browse_frm/thread/9a9a2cfacce690d/dfcd5a71ba523534?q=Just+a+few+vague+notes&rnum=1#dfcd5a71ba523534 django-developers: Change subclassing syntax] 12 20 13 == Current Status == 14 15 This was implemented into the queryset-refactoring branch in changeset r7126, there are still several bugs with it according to the commit notes. 16 17 == Subclassing == 21 === Subclassing === 18 22 19 23 For subclassing, there are 3 main issues: … … 39 43 40 44 41 === 1. Modeling parent relations in SQL?===45 ==== 1. Modeling parent relations in SQL? ==== 42 46 43 47 The general consesus seems to be this: … … 90 94 91 95 92 === 2. Modeling joins in SQL===96 ==== 2. Modeling joins in SQL ==== 93 97 94 98 When we want a list of {{{ItalianRestaurant}}}s, we obviously need all the fields from myapp_restaurant and myapp_place as well. This could be accomplished by inner joins. It would look something like this: … … 221 225 222 226 223 === 3. API===227 ==== 3. API ==== 224 228 225 229 The following API examples assume we have created these objects: … … 245 249 246 250 247 == Change the current usage of subclassing==251 === Change the current usage of subclassing === 248 252 249 253 {{{ … … 267 271 }}} 268 272 269 == Ramblings on Magic Removal Subclassing from the Pycon Sprint==273 === Ramblings on Magic Removal Subclassing from the Pycon Sprint === 270 274 271 275 Consider the following variation on the above restaurant example: … … 316 320 317 321 318 == Mixins == 322 === Mixins === 323 319 324 here are two scenarios where mixins would be useful (to me). 320 325