-
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
1 parent
e5cf82b
commit a14b774
Showing
5 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
from .views import * |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from rest_framework import serializers | ||
from apps.planners.models import Task | ||
|
||
|
||
class TaskSerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = Task | ||
fields = ( | ||
"id", | ||
"title", | ||
"description", | ||
"status", | ||
"due_date", | ||
"completed_date", | ||
"created_by", | ||
) | ||
|
||
|
||
__all__ = ("TaskSerializer",) |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from rest_framework.generics import ListAPIView | ||
from rest_framework.permissions import IsAuthenticated | ||
|
||
from apps.planners.api.TaskList.serializers import TaskSerializer | ||
from apps.planners.models import Task | ||
|
||
|
||
class TaskListAPIView(ListAPIView): | ||
serializer_class = TaskSerializer | ||
permission_classes = (IsAuthenticated,) | ||
|
||
def get_queryset(self): | ||
return Task.objects.filter(created_by=self.request.user) | ||
|
||
|
||
__all__ = ("TaskListAPIView",) |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
from .TaskList import * |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from django.urls import path | ||
|
||
from apps.planners.api.TaskList.views import TaskListAPIView | ||
|
||
urlpatterns = [ | ||
path("", TaskListAPIView.as_view(), name="task-list"), | ||
] |