Skip to content

Commit

Permalink
Removed get and delete methods from contact us
Browse files Browse the repository at this point in the history
Co-authored-by: Eduardo <eduardolimrib@gmail.com>
  • Loading branch information
Lucas362 and eilimrib committed Jun 15, 2018
1 parent 5f2104b commit 272dd78
Showing 1 changed file with 1 addition and 60 deletions.
61 changes: 1 addition & 60 deletions api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1029,10 +1029,7 @@ def most_compatible(self, request):
return Response(compatibilities_list)


class ContactUsViewset(mixins.ListModelMixin,
mixins.CreateModelMixin,
mixins.DestroyModelMixin,
mixins.RetrieveModelMixin,
class ContactUsViewset(mixins.CreateModelMixin,
viewsets.GenericViewSet):
"""Description: ContactUsViewset.
API endpoint that allows contact us
Expand All @@ -1042,37 +1039,6 @@ class ContactUsViewset(mixins.ListModelMixin,
class_name = ContactUs
queryset = ContactUs.objects.all()

def list(self, request):
"""
API endpoint that allows all 'contact us' to be viewed.
---
Response example:
```
[
"count": 2,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"topic": "title",
"email": "email@email.com",
"choice": "A",
"text": "message"
},
{
"id": 2,
"topic": "another title",
"email": "email@email.com",
"choice": "B",
"text": "another message"
}
]
]
```
"""
return super(ContactUsViewset, self).list(request)

def create(self, request):
"""
API endpoint that allows all 'contact us' to be created.
Expand All @@ -1098,28 +1064,3 @@ def create(self, request):
```
"""
return super(ContactUsViewset, self).create(request)

def destroy(self, request, pk=None):
"""
API endpoint that allows 'contact us' to be deleted.
"""
response = super(ContactUsViewset, self).destroy(request, pk)
return response

def retrieve(self, request, pk=None):
"""
API endpoint that allows a specific 'contact us' to be viewed.
---
Response example:
```
{
"id": 1,
"topic": "title",
"email": "email@email.com",
"choice": "A",
"text": "message"
}
```
"""
response = super(ContactUsViewset, self).retrieve(request, pk)
return response

0 comments on commit 272dd78

Please sign in to comment.