Beispiel #1
0
    def save(self):
        from the_tale.collections.storage import items_storage

        if id(self) != id(items_storage[self.id]):
            raise exceptions.SaveNotRegisteredItemError(item=self)

        super(ItemPrototype, self).save()

        items_storage.update_version()
Beispiel #2
0
    def create(cls, kit, caption, text, approved=False):
        from the_tale.collections.storage import items_storage

        model = cls._model_class.objects.create(kit=kit._model,
                                                caption=caption,
                                                text=text,
                                                approved=approved)

        prototype = cls(model=model)

        items_storage.add_item(prototype.id, prototype)
        items_storage.update_version()

        return prototype