-
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
Showing
3 changed files
with
21 additions
and
12 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 +1,9 @@ | ||
""" API v1 URLs. """ | ||
from django.urls import path | ||
|
||
from . import views | ||
|
||
app_name = 'v1' | ||
urlpatterns = [] | ||
urlpatterns = [ | ||
path('cards/<str:course_id>/<str:block_id>', views.cards, name='cards'), | ||
] |
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 +1,12 @@ | ||
# Create your views here. | ||
from django.views.decorators.http import require_http_methods | ||
from rest_framework.decorators import api_view, authentication_classes, permission_classes | ||
from rest_framework.response import Response | ||
|
||
from flashcards.apps.cards.anki import anki_from_block_id | ||
|
||
|
||
@api_view(['GET']) # TODO get is completely wrong here but convenient for testing | ||
@require_http_methods(['GET']) | ||
def cards(request, course_id, block_id): | ||
cards = anki_from_block_id(course_id, block_id) | ||
return Response("cards") |
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