摘要: #前端 对后端返回数据进行处理,自带filter 后端返回:status = "很高兴见到你" , word=' nice too meet you’ 1-{{ status|length }} ==6, 长度 2-{{ word|upper }} ,大写 3-{{ tmp_html|safe }} 阅读全文
posted @ 2020-09-03 14:04 whcp 阅读(570) 评论(0) 推荐(0)
摘要: #前端页面分页 Paginator #views逻辑 from django.core.paginator import Paginatordef index(request): page = request.GET.get('page') articles = models.Article.obj 阅读全文
posted @ 2020-09-03 13:49 whcp 阅读(357) 评论(0) 推荐(0)
摘要: #自定义filter(过滤器) user下新建目录:templatetags,下新建:tmpTags.py from django import templateregister = template.Library@register.filterdef status_filter(x): retu 阅读全文
posted @ 2020-09-03 10:13 whcp 阅读(126) 评论(0) 推荐(0)