diff --git a/Dstonylion/AI/views.py b/Dstonylion/AI/views.py index 6e8d642..34dc001 100644 --- a/Dstonylion/AI/views.py +++ b/Dstonylion/AI/views.py @@ -28,6 +28,7 @@ from .models import * from .serializers import * +from mylibrary.models import * from story.models import Story, StoryPage, Illustrations from story.serializers import * from story.utils import split_into_pages @@ -1284,6 +1285,11 @@ def post(self, request, story_id): illustration_style=request.data.get("illustration_style") or original.illustration_style ) + Library.objects.get_or_create( + user=request.user, + story=new_story, + ) + pages = split_into_pages(combined_content) for idx, page_text in enumerate(pages, start=1): StoryPage.objects.create( diff --git a/Dstonylion/story/views.py b/Dstonylion/story/views.py index 2c15c29..0e20a71 100644 --- a/Dstonylion/story/views.py +++ b/Dstonylion/story/views.py @@ -499,6 +499,11 @@ def post(self, request): custom_theme, _ = MoralTheme.objects.get_or_create(name=kw, defaults={"key": f"custom_{kw}"}) story.morals.add(custom_theme) + Library.objects.get_or_create( + user=request.user, + story=story, + ) + pages = split_into_pages(body) for id, page_text in enumerate(pages, start=1):