2degrees/djeneralize — Issue #9: more helpful error messages
Author: sebpiq
Created: 2011-11-09 12:44:40+00:00
State: open

I have the following hierarchy of models :

Machine
| |
V V
Work Personal
|
V
CI

When creating any object, then you can't call "specializations" manager on its model anymore ... for example :
>>> ci = CI() ; ci.save()
>>> CI.specializations.all()
Traceback .....
KeyError: u'/work/ci/'

I see what's the problem, and I guess there is a design decision to be taken :

- non-final specializations can't be instantiated and final specializations don't have a "specializations" manager
OR
- everything can be instantiated, and then "CI._meta.specializations" needs to contain "/work/ci/" as well (i.e. each GeneralizationModel contains also itself as a possible specialization)
OR
- "specializations" manager excludes the instances of the calling model class

I can try to implement any of those :)