|
1 | 1 | import django_filters.rest_framework as filters
|
2 | 2 | from django.utils.safestring import mark_safe
|
3 | 3 | from rest_flex_fields.views import FlexFieldsMixin
|
| 4 | +from rest_framework import status |
4 | 5 | from rest_framework.authentication import TokenAuthentication
|
5 | 6 | from rest_framework.decorators import action
|
6 | 7 | from rest_framework.metadata import SimpleMetadata
|
@@ -170,7 +171,7 @@ def superproject(self, request, project_slug):
|
170 | 171 | data = self.get_serializer(superproject).data
|
171 | 172 | return Response(data)
|
172 | 173 | except Exception:
|
173 |
| - return Response(status=404) |
| 174 | + return Response(status=status.HTTP_404_NOT_FOUND) |
174 | 175 |
|
175 | 176 |
|
176 | 177 | class SubprojectRelationshipViewSet(APIv3Settings, NestedViewSetMixin,
|
@@ -259,7 +260,7 @@ def update(self, request, *args, **kwargs):
|
259 | 260 | # ``httpOnly`` on our cookies and the ``PUT/PATCH`` method are triggered
|
260 | 261 | # via Javascript
|
261 | 262 | super().update(request, *args, **kwargs)
|
262 |
| - return Response(status=204) |
| 263 | + return Response(status=status.HTTP_204_NO_CONTENT) |
263 | 264 |
|
264 | 265 |
|
265 | 266 | class BuildsViewSet(APIv3Settings, NestedViewSetMixin, ProjectQuerySetMixin,
|
@@ -299,8 +300,8 @@ def create(self, request, **kwargs): # pylint: disable=arguments-differ
|
299 | 300 |
|
300 | 301 | if build:
|
301 | 302 | data.update({'triggered': True})
|
302 |
| - status = 202 |
| 303 | + code = status.HTTP_202_ACCEPTED |
303 | 304 | else:
|
304 | 305 | data.update({'triggered': False})
|
305 |
| - status = 400 |
306 |
| - return Response(data=data, status=status) |
| 306 | + code = status.HTTP_400_BAD_REQUEST |
| 307 | + return Response(data=data, status=code) |
0 commit comments