Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在django5.1版本中,templatetags删除了“length_is”,导致编辑记录时报错 #504

Open
zrtchp opened this issue Aug 19, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@zrtchp
Copy link

zrtchp commented Aug 19, 2024

bug描述

  • *Bug description * *

简单的描述下遇到的bug:
点击任何一个model中的记录进行修改时,均提示“length_is“方法错误
通过网络搜索,在django5.1起删除了”length_is“这个方法 ,网上有两种解决方式,一种是自己将旧版django中的这段代码复制为templatetags并在settings.py中导入,另一种是将length_is写法修改。
查询了一下”simpleui/templates/“目录下,仅有”simpleui/templates/admin/includes/fieldset.html“中四处应用了这个方法,根据网上的教程将”length_is:'1'“改写成”length == 1“以后,程序可以正常运行。
第一次在github上反馈,可能有些描述不清楚,请谅解。

重现步骤
** repeat step **
1.使用django5.1 startproject,引入simpleui,执行migrate,创建用户后进入后台
2.点击用户组,编辑用户信息
3.网页报错

环境
** environment**

1.Operating System:Windows11

2.Python Version:3.12

3.Django Version:5.1

4.SimpleUI Version:2024.4.1

Description

@zrtchp zrtchp added the bug Something isn't working label Aug 19, 2024
@DICKQI
Copy link

DICKQI commented Aug 21, 2024

对的,为此我还把版本降低回到了5.0

@maoxuner
Copy link
Contributor

  1. 根本解决办法是模板中使用length过滤器来替代,参考 https://stackoverflow.com/a/78894082
  2. 临时解决办法是把length_is过滤器复制回来,参考 https://stackoverflow.com/a/78883955

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants