products endpoint
This commit is contained in:
parent
e1e1628caf
commit
96a9dc1114
@ -23,6 +23,7 @@ from alkatorapi.views import (
|
|||||||
payment_result, payment_state,
|
payment_result, payment_state,
|
||||||
invoice, upload_files,
|
invoice, upload_files,
|
||||||
login_status, change_racer,
|
login_status, change_racer,
|
||||||
|
products,
|
||||||
)
|
)
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
@ -40,4 +41,5 @@ urlpatterns = [
|
|||||||
path('api/payment_state', payment_state),
|
path('api/payment_state', payment_state),
|
||||||
path('api/invoice', invoice),
|
path('api/invoice', invoice),
|
||||||
path('api/upload_files', upload_files),
|
path('api/upload_files', upload_files),
|
||||||
|
path('api/products', products)
|
||||||
]
|
]
|
||||||
|
@ -328,6 +328,19 @@ def payment_state(request):
|
|||||||
return HttpResponse('{"status":"failed", "reason":"Závodník neexistuje, registraci závodníka prosím opakujte."}', content_type='application/json')
|
return HttpResponse('{"status":"failed", "reason":"Závodník neexistuje, registraci závodníka prosím opakujte."}', content_type='application/json')
|
||||||
|
|
||||||
|
|
||||||
|
def products(request):
|
||||||
|
return HttpResponse(json.dumps([
|
||||||
|
{
|
||||||
|
'name': product.name,
|
||||||
|
'description': product.description,
|
||||||
|
'img': product.img,
|
||||||
|
'price': product.price,
|
||||||
|
'quantity': product.quantity,
|
||||||
|
}
|
||||||
|
for product in Product.objects.all()
|
||||||
|
]), content_type='application/json')
|
||||||
|
|
||||||
|
|
||||||
def results(request):
|
def results(request):
|
||||||
results = []
|
results = []
|
||||||
n = 1
|
n = 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user