Ejemplo n.º 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()
Ejemplo n.º 2
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()
Ejemplo n.º 3
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
Ejemplo n.º 4
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