Подскажите, что не так в коде?
Шаблон:
{% load static %}
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="{% static '/css/reset.css' %}">
<link rel="stylesheet" href="{% static '/css/index.css' %}">
<link rel="icon" type="image/x-icon" href=""/>
</head>
<body>
{% for order in order_name %}
{% if order.user_id == 99100639 %}
<h1>{{ order.order_name }}</h1>
{% endif %}
{% endfor %}
</body>
</html>
views.py:
from django.contrib.auth import login, authenticate
from django.shortcuts import render, redirect
from django.http import HttpResponseRedirect
from django.contrib.auth.views import LoginView
from incones.models import order
def generalSTR(request):
user_id = order.objects.order_by('-user_id',)
order_name = order.objects.order_by('-order_name',)
context = {
'user_id': user_id,
'order_name': order_name,
}
return render(request, 'index.html', context)
models.py:
from django.db import models
# Create your models here.
class code(models.Model):
codename = models.TextField(
verbose_name = 'Коды приглашения',
)
class order(models.Model):
user_id = models.TextField(
verbose_name='Номер пользователя',
)
order_name = models.TextField(
verbose_name = 'Название заказа',
)