返回的数据是列表集合,如

n [5]: a = set()                                                                  

In [6]: a.add((1, 3))

In [7]: a
Out[7]: {(1, 3)}

在模板中使用方式如下:

 {% for archive in archive_lists  %}
<li>
<a href="/archive/{{ archive.0 }}/{{ archive.1 }} ">{{ archive }}</a>
</li>
{% endfor %}

参考见:

http://stackoverflow.com/questions/5231171/django-templatesyntaxerror-could-not-parse-the-remainder

  

Django TemplateSyntaxError Could not parse the remainder: '()'的更多相关文章

  1. cnblog项目--20190309

    第一个真正意义的Django项目 ! 预计时间5天  20190309--20190314 目标:学会Django的使用,理解模块关系!   querset  相当于一个存放列表的字典     day ...

  2. The Django template language 阅读批注

    The Django template language About this document This document explains the language syntax of the D ...

  3. django for 循环中,获取序号

    模板的for循环中,如何获取序号? 想过用enumerate,但是在模板中会报错 Could not parse the remainder xxx: 后来搜到 forloop.counter,完美解 ...

  4. django.template.exceptions.TemplateSyntaxError: 'article_tags' is not a registered tag library.

    django.template.exceptions.TemplateSyntaxError: 'article_tags' is not a registered tag library. Must ...

  5. django.template.exceptions.TemplateSyntaxError: 'static' is not a registered tag library. Must be one of:

    在访问web页面时报错,详细日志如下: django.template.exceptions.TemplateSyntaxError: 'staticfiles' is not a registere ...

  6. Django 自定义模板标签 报错django.template.exceptions.TemplateSyntaxError: '####' is not a registered tag library. Must be one of:

    我写代码遇到这个错误,但是发现程序没有写错,好像是程序有缓存,重新运行几次就好了. 自定义模板标签,可以不用写views,url直接通过自定义函数把变量传给模板. 具体实现: 1.在app下新建Pyt ...

  7. django 补充篇

    from验证 django中的Form一般有两种功能: 输入html-----------不能你自己写一些标签,而帮你自动生成 验证用户输入-------将用户验证信息保存起来,可以传到前端 # !/ ...

  8. Django 模版语言详解

    一.简介 模版是纯文本文件.它可以产生任何基于文本的的格式(HTML,XML,CSV等等). 模版包括在使用时会被值替换掉的 变量,和控制模版逻辑的 标签. 例: {% extends "b ...

  9. django 的模板语言

    1.模版的执行 模版的创建过程,对于模版,其实就是读取模版(其中嵌套着模版标签),然后将 Model 中获取的数据插入到模版中,最后将信息返回给用户. def current_datetime(req ...

随机推荐

  1. 理解Android虚拟机体系结构

    1 什么是Dalvik虚拟机 Dalvik是Google公司自己设计用于Android平台的Java虚拟机,它是Android平台的重要组成部分,支持dex格式(Dalvik Executable)的 ...

  2. Windows 10 后台音频

    UWP版本的网易云音乐已经上架,虽然还不支持Windows Phone但是整体而言功能已经比较齐全了! 那么如何在Windows 10 UWP实现后台播放呢? 我之前是一直在做Windows Phon ...

  3. 使用D3绘制图表(3)--添加坐标轴和文本标签

    上一篇是曲线的绘制,这样仅仅只是有一条线,完全先是不出数据想要表现的内容,于是我们要添加坐标系,添加坐标系和画线类似. 1.还是没有变化的html页面 <!DOCTYPE html> &l ...

  4. Android NestedScrolling与分发机制 二

    上篇转载了 Android:30分钟弄明白Touch事件分发机制 这篇转载 Android中的dispatchTouchEvent().onInterceptTouchEvent()和onTouchE ...

  5. Swift基础--通知,代理和block的使用抉择以及Swift中的代理

    什么时候用通知,什么时候用代理,什么时候用block 通知 : 两者关系层次太深,八竿子打不着的那种最适合用通知.因为层级结构深了,用代理要一层一层往下传递,代码结构就复杂了 代理 : 父子关系,监听 ...

  6. Java设计模式(二) 观察者模式

    观察者模式: 定义了对象之间的一对多依赖,这样一来,当一个对象改变状态时,他的所有依赖者都会受到通知并自动更新. 1,定义事件源接口 package com.pattern.observer; pub ...

  7. 【CodeVS 3290】【NOIP 2013】华容道

    http://codevs.cn/problem/3290/ 据说2013年的noip非常难,但Purpleslz学长还是AK了.能A掉这道题真心orz. 设状态$(i,j,k)$表示目标棋子在$(i ...

  8. Doccms 中新闻列表排序无效bug的修复

    手动修改 content/index/list.php 37 为 $sql="Select * FROM ".TB_PREFIX."list Where channelI ...

  9. bzoj3998: [TJOI2015]弦论

    SAM小裸题qwq #include <iostream> #include <cstdio> #include <cmath> #include <cstr ...

  10. Urtext的使用

    UITextField 是UIControl的子类,UIControl又是UIView的子类,所以也是一个视图,只不过比UIView多了两个功能,1.文字显示,2.文本编辑 使用过程分四步: 1.创建 ...