-
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.
Add the beginnings of an API, plus an API endpoint to display a speci…
…fic slide
- Loading branch information
1 parent
7b6c9a2
commit 6948e4b
Showing
4 changed files
with
21 additions
and
1 deletion.
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,5 @@ | ||
from ninja import NinjaAPI | ||
|
||
api = NinjaAPI() | ||
|
||
api.add_router("/slides/", "slides.api.router") |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from ninja import Router | ||
from .models import Slide, Show | ||
from django.shortcuts import get_object_or_404 | ||
|
||
router = Router() | ||
|
||
|
||
@router.post("show_slide") | ||
def show_slide(request, slide_pk, show_pk): | ||
slide = get_object_or_404(Slide, pk=slide_pk) | ||
show = get_object_or_404(Show, pk=show_pk) | ||
slide.send_to_display(show.displays.all(), show=show) |
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 |
---|---|---|
|
@@ -10,4 +10,5 @@ django-feather | |
pypjlink | ||
gunicorn | ||
uvicorn | ||
django-environ | ||
django-environ | ||
django-ninja |