def save(self): from the_tale.collections.storage import collections_storage if id(self) != id(collections_storage[self.id]): raise exceptions.SaveNotRegisteredCollectionError(collection=self) super(CollectionPrototype, self).save() collections_storage.update_version()
def create(cls, caption, description, approved=False): from the_tale.collections.storage import collections_storage model = cls._model_class.objects.create(caption=caption, description=description, approved=approved) prototype = cls(model=model) collections_storage.add_item(prototype.id, prototype) collections_storage.update_version() return prototype