Changes between Version 17 and Version 18 of DjangoSpecifications/Core/SingleInstance
- Timestamp:
- Mar 25, 2008, 6:07:01 AM (17 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
DjangoSpecifications/Core/SingleInstance
v17 v18 99 99 #17 currently has a working patch with the following: 100 100 * Per-model WeakValueDictionary with dict[pk_val] = instance. 101 * __call__ classmethod which either gets a instance from the dict or return a newly created one.101 * !__call!__ classmethod which either gets a instance from the dict or return a newly created one. 102 102 * a simple interface for enabling or disabling the feature for a given Model (default is disabled). 103 103 * a slightly modified related manager which will first try to get the instance from the Model dict instead of blindly querying the DB. … … 115 115 116 116 === Discussion === 117 The current patch design overrides the ____call____ method for the model base which means it automatically returns singleton instances when available. This is convenient because XXX (David or Brian: feel free to fill this out).117 The current patch design overrides the !__call!__ method for the model base which means it automatically returns singleton instances when available. This is convenient because XXX (David or Brian: feel free to fill this out). 118 118 119 119 Another approach would be to make this explicit and have a simple API along the lines of: