Fixed some small errors

This commit is contained in:
david 2023-05-19 17:03:06 +02:00
parent c4af1d1808
commit 76fee9b57a
2 changed files with 3 additions and 5 deletions

View File

@ -1,7 +1,7 @@
# VideoAPI # VideoAPI
## Search ## Search
`GET \api?param=value` `GET /api/?param=value`
### Parameters ### Parameters
| Param | Value | | Param | Value |
@ -21,6 +21,4 @@
``` ```
### Examples ### Examples
> `GET /api?q=foo&limit=3` will return the first 3 videos with "foo" in their name. > `GET /api/?q=foo&limit=3` will return the first 3 videos with "foo" in their name.

View File

@ -7,7 +7,7 @@ from core.serializers import VideoSerializer
@api_view(['GET']) @api_view(['GET'])
def videoAPI(request): def videoAPI(request):
q = request.GET.get('q', '') q = request.GET.get('q', '')
l = request.GET.get('limit', '') l = request.GET.get('limit', '6')
try: try:
l = int(l) l = int(l)
videos = Video.objects.filter(Q(id__contains=q) | Q(name__contains=q))[:l] videos = Video.objects.filter(Q(id__contains=q) | Q(name__contains=q))[:l]