-
Notifications
You must be signed in to change notification settings - Fork 442
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
8f70b64
commit f897583
Showing
5 changed files
with
54 additions
and
8 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,25 @@ | ||
# Generated by Django 4.1 on 2024-11-16 08:40 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Author', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('first_name', models.CharField(max_length=64)), | ||
('last_name', models.CharField(max_length=64)), | ||
('pseudonym', models.CharField(blank=True, max_length=64, null=True)), | ||
('age', models.IntegerField()), | ||
('retired', models.BooleanField()), | ||
], | ||
), | ||
] |
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,3 +1,13 @@ | ||
# 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="author") | ||
|
||
urlpatterns = [ | ||
path("", include(router.urls)) | ||
] | ||
|
||
app_name = "author" |
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,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 |