-
Notifications
You must be signed in to change notification settings - Fork 3
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
12 changed files
with
34 additions
and
33 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 |
---|---|---|
@@ -1,4 +0,0 @@ | ||
# .dockerignore | ||
.venv | ||
.git | ||
.gitignore | ||
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,4 +1,3 @@ | ||
# Pull base image | ||
FROM python:3.11.5-slim-bullseye | ||
|
||
# Set environment variables | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
services: | ||
web: | ||
build: . | ||
ports: | ||
- "8000:8000" | ||
command: python manage.py runserver 0.0.0.0:8000 | ||
volumes: | ||
- .:/code | ||
web: | ||
build: . | ||
ports: | ||
- "8000:8000" | ||
command: python manage.py runserver 0.0.0.0:8000 | ||
volumes: | ||
- .:/code |
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,11 @@ | ||
from rest_framework import serializers | ||
from .models import Thing | ||
|
||
|
||
class ThingSerializer(serializers.ModelSerializer): | ||
class Meta: | ||
fields = ("id", "owner", "name", "description", "created_at") | ||
model = Thing | ||
class Meta: | ||
fields = ("id","owner","name","description","created_at") | ||
model = Thing | ||
|
||
|
||
|
||
|
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,18 +1,16 @@ | ||
from rest_framework import generics | ||
from .serializers import ThingSerializer | ||
from rest_framework.generics import ListCreateAPIView, RetrieveUpdateDestroyAPIView | ||
from .models import Thing | ||
from .serializers import ThingSerializer | ||
|
||
|
||
class ThingList(generics.ListCreateAPIView): | ||
|
||
class ThingList(ListCreateAPIView): | ||
# Anything that inherits from ListAPI View is going to need 2 things. | ||
# What is the collection of things, aka the queryset | ||
# Serializer_class | ||
queryset = Thing.objects.all() | ||
serializer_class = ThingSerializer | ||
|
||
#serializing | ||
serializer_class = ThingSerializer | ||
|
||
# The ThingDetail needs the same things | ||
class ThingDetail(generics.RetrieveUpdateDestroyAPIView): | ||
class ThingDetail(RetrieveUpdateDestroyAPIView): | ||
queryset = Thing.objects.all() | ||
serializer_class = ThingSerializer |
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