diff options
author | 2019-07-10 04:16:25 +0100 | |
---|---|---|
committer | 2019-07-10 04:16:25 +0100 | |
commit | dce0678b6d19fd210a5862b503ae9dcc7b894410 (patch) | |
tree | 3dec1435c12bdada903585719ff8b9abc3c1faa7 /pydis_site/apps/api/viewsets | |
parent | Teach new lint rules to old code (diff) |
Give a code a lint
Diffstat (limited to 'pydis_site/apps/api/viewsets')
4 files changed, 0 insertions, 12 deletions
diff --git a/pydis_site/apps/api/viewsets/bot/infraction.py b/pydis_site/apps/api/viewsets/bot/infraction.py index 4be153e1..e1f9c431 100644 --- a/pydis_site/apps/api/viewsets/bot/infraction.py +++ b/pydis_site/apps/api/viewsets/bot/infraction.py @@ -124,7 +124,6 @@ class InfractionViewSet(CreateModelMixin, RetrieveModelMixin, ListModelMixin, Ge def partial_update(self, request, *_args, **_kwargs): """Method that handles the nuts and bolts of updating an Infraction.""" - for field in request.data: if field in self.frozen_fields: raise ValidationError({field: ['This field cannot be updated.']}) @@ -143,7 +142,6 @@ class InfractionViewSet(CreateModelMixin, RetrieveModelMixin, ListModelMixin, Ge Called by the Django Rest Framework in response to the corresponding HTTP request. """ - self.serializer_class = ExpandedInfractionSerializer return self.list(*args, **kwargs) @@ -154,7 +152,6 @@ class InfractionViewSet(CreateModelMixin, RetrieveModelMixin, ListModelMixin, Ge Called by the Django Rest Framework in response to the corresponding HTTP request. """ - self.serializer_class = ExpandedInfractionSerializer return self.create(*args, **kwargs) @@ -165,7 +162,6 @@ class InfractionViewSet(CreateModelMixin, RetrieveModelMixin, ListModelMixin, Ge Called by the Django Rest Framework in response to the corresponding HTTP request. """ - self.serializer_class = ExpandedInfractionSerializer return self.retrieve(*args, **kwargs) @@ -176,6 +172,5 @@ class InfractionViewSet(CreateModelMixin, RetrieveModelMixin, ListModelMixin, Ge Called by the Django Rest Framework in response to the corresponding HTTP request. """ - self.serializer_class = ExpandedInfractionSerializer return self.partial_update(*args, **kwargs) diff --git a/pydis_site/apps/api/viewsets/bot/nomination.py b/pydis_site/apps/api/viewsets/bot/nomination.py index 62f5dd48..dad33056 100644 --- a/pydis_site/apps/api/viewsets/bot/nomination.py +++ b/pydis_site/apps/api/viewsets/bot/nomination.py @@ -19,7 +19,6 @@ class NominationViewSet(ModelViewSet): Called by the Django Rest Framework in response to the corresponding HTTP request. """ - for field in request.data: if field in self.frozen_fields: raise ValidationError({field: ['This field cannot be updated.']}) diff --git a/pydis_site/apps/api/viewsets/bot/off_topic_channel_name.py b/pydis_site/apps/api/viewsets/bot/off_topic_channel_name.py index 4976c291..d977aade 100644 --- a/pydis_site/apps/api/viewsets/bot/off_topic_channel_name.py +++ b/pydis_site/apps/api/viewsets/bot/off_topic_channel_name.py @@ -60,14 +60,12 @@ class OffTopicChannelNameViewSet(DestroyModelMixin, ViewSet): If it doesn't, a HTTP 404 is returned by way of throwing an exception. """ - queryset = self.get_queryset() name = self.kwargs[self.lookup_field] return get_object_or_404(queryset, name=name) def get_queryset(self): """Returns a queryset that covers the entire OffTopicChannelName table.""" - return OffTopicChannelName.objects.all() def create(self, request): @@ -76,7 +74,6 @@ class OffTopicChannelNameViewSet(DestroyModelMixin, ViewSet): Called by the Django Rest Framework in response to the corresponding HTTP request. """ - if 'name' in request.query_params: create_data = {'name': request.query_params['name']} serializer = OffTopicChannelNameSerializer(data=create_data) @@ -95,7 +92,6 @@ class OffTopicChannelNameViewSet(DestroyModelMixin, ViewSet): Called by the Django Rest Framework in response to the corresponding HTTP request. """ - if 'random_items' in request.query_params: param = request.query_params['random_items'] try: diff --git a/pydis_site/apps/api/viewsets/bot/snake_name.py b/pydis_site/apps/api/viewsets/bot/snake_name.py index 8e63a542..113c6899 100644 --- a/pydis_site/apps/api/viewsets/bot/snake_name.py +++ b/pydis_site/apps/api/viewsets/bot/snake_name.py @@ -42,7 +42,6 @@ class SnakeNameViewSet(ViewSet): def get_queryset(self): """Returns a queryset that covers the entire SnakeName table.""" - return SnakeName.objects.all() def list(self, request): @@ -51,7 +50,6 @@ class SnakeNameViewSet(ViewSet): Called by the Django Rest Framework in response to the corresponding HTTP request. """ - if request.query_params.get('get_all'): queryset = self.get_queryset() serialized = self.serializer_class(queryset, many=True) |