Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution #449

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions author/serializers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from rest_framework import serializers

from author.models import Author


class AuthorSerializer(serializers.ModelSerializer):
# write your code here
pass
class Meta:
model = Author
fields = ["first_name", "last_name", "pseudonym", "age", "retired"]
15 changes: 13 additions & 2 deletions author/urls.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# Create your urls here
from django.urls import path, include
from rest_framework import routers

urlpatterns = []
from author.views import AuthorViewSet


router = routers.DefaultRouter()
router.register("manage", AuthorViewSet, basename="manage")

urlpatterns = [
path("", include(router.urls))
]

app_name = "author"
7 changes: 5 additions & 2 deletions author/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from rest_framework import viewsets

from author.models import Author
from author.serializers import AuthorSerializer


class AuthorViewSet(viewsets.ModelViewSet):
# write your code here
pass
queryset = Author.objects.all()
serializer_class = AuthorSerializer
Loading