сообщение об ошибке -> Представление orders.views.charge не возвращало объект HttpResponse. Вместо этого он вернул None. есть какая-либо причина, почему мой заряд. html не работает?
просмотров, py
import time
import stripe
from django.conf import settings
from django.shortcuts import render
from django.urls import reverse
def charge(request):
if request.method == 'POST':
charge = stripe.Charge.create(
amount=500,
currency='eur',
description='A Django charge',
source=request.POST['stripeToken']
)
template = "orders/charge.html"
return render(request, template)
заряд. html
{% extends "fuisce/base.html" %}
{% block content %}
<div class="container mt-5 text-center">
<h2 class="text-center">Thanks, you for your Orders</h2>
<a href="/my-orders" class="btn btn-success">My Orders</a>
</div>
{% endblock %}
urls.py
from django.urls import path
from . import views
from orders import views as order_views
from users import views as user_views
urlpatterns = [
path('checkout/', order_views.checkout, name='checkout'),
path('charge/', order_views.charge, name='charge'),
path('orders/', order_views.orders, name='user_orders'),
path('add_user_address/', user_views.add_user_address, name='add_user_address'),
]