-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
27 additions
and
102 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file modified
BIN
-25 Bytes
(97%)
website/migrations/__pycache__/0004_auto_20170305_2006.cpython-35.pyc
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
from django.conf.urls import url | ||
from website.views import (GetMessageList, | ||
PostMessage) | ||
PostMessage, | ||
PostMessageDev) | ||
|
||
urlpatterns = [ | ||
url(r'messagelist/$', GetMessageList.as_view()), | ||
url(r'postmessage/$', PostMessage.as_view()), | ||
url(r'postmessagedev/$', PostMessageDev.as_view()), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,30 @@ | ||
# from django.shortcuts import render | ||
from rest_framework import generics | ||
# from rest_framework.views import APIView | ||
from rest_framework.filters import OrderingFilter | ||
|
||
from website.models import Messages | ||
from website.serializer import (GetMessageSerializer, | ||
PostMessageSerializer) | ||
from rest_framework import parsers | ||
from rest_framework import filters | ||
|
||
|
||
# Create your views here. | ||
|
||
class GetMessageList(generics.ListAPIView): | ||
queryset = Messages.objects.all() | ||
serializer_class = GetMessageSerializer | ||
filter_backends = (filters.OrderingFilter, filters.SearchFilter) | ||
search_fields = ('content',) | ||
ordering = ('-time',) | ||
|
||
|
||
class PostMessage(generics.CreateAPIView): | ||
serializer_class = PostMessageSerializer | ||
parser_classes = (parsers.JSONParser,) | ||
|
||
|
||
class PostMessageDev(generics.CreateAPIView): | ||
serializer_class = PostMessageSerializer | ||
parser_classes = (parsers.FormParser,) |