fix of invoice_id
This commit is contained in:
parent
bed195770e
commit
4e21f3aa3b
@ -118,7 +118,7 @@ def register_racer(request):
|
|||||||
invoice_id=invoice_id,
|
invoice_id=invoice_id,
|
||||||
user=user,
|
user=user,
|
||||||
total_price=price,
|
total_price=price,
|
||||||
address=profile.address,
|
address="",
|
||||||
)
|
)
|
||||||
racer = Racer(
|
racer = Racer(
|
||||||
product=product,
|
product=product,
|
||||||
@ -180,7 +180,7 @@ def login_status(request):
|
|||||||
"last_name": user.profile.last_name,
|
"last_name": user.profile.last_name,
|
||||||
"address": user.profile.address,
|
"address": user.profile.address,
|
||||||
"racers": [{
|
"racers": [{
|
||||||
"invoice_id": racer.invoice_id,
|
"id": racer.invoice_id,
|
||||||
"first_name": racer.first_name,
|
"first_name": racer.first_name,
|
||||||
"last_name": racer.last_name,
|
"last_name": racer.last_name,
|
||||||
"email": racer.email,
|
"email": racer.email,
|
||||||
@ -195,7 +195,7 @@ def login_status(request):
|
|||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def change_racer(request):
|
def change_racer(request):
|
||||||
try:
|
try:
|
||||||
racer = Racer.objects.get(invoice_id=request.POST['invoice_id'])
|
racer = Racer.objects.get(invoice_id=request.POST['id'])
|
||||||
if request.user != racer.profile.user:
|
if request.user != racer.profile.user:
|
||||||
return HttpResponse('{"reason":"Nedostatečná práva!"}', status=400, content_type='application/json')
|
return HttpResponse('{"reason":"Nedostatečná práva!"}', status=400, content_type='application/json')
|
||||||
if date.today() >= DEADLINE:
|
if date.today() >= DEADLINE:
|
||||||
@ -320,11 +320,11 @@ web: https://alkator.cz""",
|
|||||||
def payment_state(request):
|
def payment_state(request):
|
||||||
invoice_id = request.GET['refId']
|
invoice_id = request.GET['refId']
|
||||||
try:
|
try:
|
||||||
if Racer.objects.get(invoice_id=invoice_id).paid:
|
if Invoice.objects.get(invoice_id=invoice_id).paid:
|
||||||
return HttpResponse('{"status":"success", "reason":"Úspěšná platba"}', content_type='application/json')
|
return HttpResponse('{"status":"success", "reason":"Úspěšná platba"}', content_type='application/json')
|
||||||
else:
|
else:
|
||||||
return HttpResponse('{"status":"failed", "reason":"Zatím nemáme informace o provedené platbě. Zkuste reload nebo zkontrolujte email."}', content_type='application/json')
|
return HttpResponse('{"status":"failed", "reason":"Zatím nemáme informace o provedené platbě. Zkuste reload nebo zkontrolujte email."}', content_type='application/json')
|
||||||
except Racer.DoesNotExist:
|
except Invoice.DoesNotExist:
|
||||||
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')
|
||||||
|
|
||||||
|
|
||||||
@ -338,7 +338,7 @@ def products(request):
|
|||||||
'price': product.price,
|
'price': product.price,
|
||||||
'quantity': product.quantity,
|
'quantity': product.quantity,
|
||||||
}
|
}
|
||||||
for product in Product.objects.all()
|
for product in Product.objects.all()[1:]
|
||||||
]), content_type='application/json')
|
]), content_type='application/json')
|
||||||
|
|
||||||
|
|
||||||
|
@ -379,7 +379,7 @@ class Main extends Component {
|
|||||||
<div class="container text" onClick={(e) => e.stopPropagation()}>
|
<div class="container text" onClick={(e) => e.stopPropagation()}>
|
||||||
<form id="form" class="container" action="/api/change_racer" onSubmit={(e) => this.onSubmit(e)}>
|
<form id="form" class="container" action="/api/change_racer" onSubmit={(e) => this.onSubmit(e)}>
|
||||||
<h1>Výměna závodníka</h1>
|
<h1>Výměna závodníka</h1>
|
||||||
<input type="hidden" name="invoice_id" value={this.state.racer.invoice_id} />
|
<input type="hidden" name="id" value={this.state.racer.id} />
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="first_name" class="form-label">Jméno</label>
|
<label for="first_name" class="form-label">Jméno</label>
|
||||||
<input type="text" class="form-control" id="first_name" name="first_name" value={this.state.racer.first_name} onChange={(e) => this.handleChange(e)} />
|
<input type="text" class="form-control" id="first_name" name="first_name" value={this.state.racer.first_name} onChange={(e) => this.handleChange(e)} />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user