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