Example #1
0
 async def post(self, request):
     cleaned_data = await self._validate(request)
     podcast = await Podcast.async_create(
         db_session=request.db_session,
         name=cleaned_data["name"],
         publish_id=Podcast.generate_publish_id(),
         description=cleaned_data["description"],
         created_by_id=request.user.id,
     )
     return self._response(podcast, status_code=status.HTTP_201_CREATED)
Example #2
0
 async def post(self):
     cleaned_data = await self._validate()
     podcast = await self.request.app.objects.create(
         Podcast,
         **dict(
             publish_id=Podcast.generate_publish_id(),
             name=cleaned_data["name"],
             description=cleaned_data.get("description", ""),
             created_by_id=self.user.id,
         ),
     )
     return redirect(self.request, "podcast_details", podcast_id=podcast.id)