(self, request, slug, project_id)
| 127 | ) |
| 128 | |
| 129 | def create(self, request, slug, project_id): |
| 130 | serializer = PageSerializer( |
| 131 | data=request.data, |
| 132 | context={ |
| 133 | "project_id": project_id, |
| 134 | "owned_by_id": request.user.id, |
| 135 | "description_json": request.data.get("description_json", {}), |
| 136 | "description_binary": request.data.get("description_binary", None), |
| 137 | "description_html": request.data.get("description_html", "<p></p>"), |
| 138 | }, |
| 139 | ) |
| 140 | |
| 141 | if serializer.is_valid(): |
| 142 | serializer.save() |
| 143 | # capture the page transaction |
| 144 | page_transaction.delay( |
| 145 | new_description_html=request.data.get("description_html", "<p></p>"), |
| 146 | old_description_html=None, |
| 147 | page_id=serializer.data["id"], |
| 148 | ) |
| 149 | page = self.get_queryset().get(pk=serializer.data["id"]) |
| 150 | serializer = PageDetailSerializer(page) |
| 151 | return Response(serializer.data, status=status.HTTP_201_CREATED) |
| 152 | return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) |
| 153 | |
| 154 | def partial_update(self, request, slug, project_id, page_id): |
| 155 | try: |
no test coverage detected