每当来自一个模型的int
变量==我的循环iteration
时,我都试图打印一些东西。
我的iteration
计数器正确递增,并且如果我将其更改为if data.number == '1'
,则测试通过。
编辑:我要提到if data.number == 1
失败了,我认为这很奇怪。
我已经阅读了很多有关此的文章,并且我相信这应该可以,但是不能。
{% for iteration in range %}
{% for data in lesson_data.all %}
# this never passes
{% if data.number == iteration|add:"1" %}
谢谢。
答案 0 :(得分:0)
哇,我不得不施放:
import discord
from discord.ext import commands
client = commands.Bot(command_prefix = "!")
swingsMessage = "Update me"
@client.command()
async def swings(ctx):
await ctx.send(swingsMessage)
@client.command()
async def update(ctx,*,message):
if str(ctx.message.author) == "buysellshort#9420":
global swingsMessage
swingsMessage = message