for key, newvalue in self.changes.items():\r
newvalue = newvalue.resolve(context)\r
if newvalue=='' or newvalue is None: params.pop(key, False)\r
- else: params[key] = newvalue\r
+ else: params[key] = unicode(newvalue)\r
# ``urlencode`` chokes on unicode input, so convert everything to\r
# utf8. Note that if some query arguments passed to the site have\r
# their non-ascii characters screwed up when passed though this,\r
"""\r
\r
from py.test import raises\r
+from django.template import Template, Context, add_to_builtins\r
+from django.http import HttpRequest\r
import django_tables as tables\r
\r
def test_order_by():\r
{'name': 'Netherlands', 'capital': 'Amsterdam', 'calling_code': '31'},\r
{'name': 'Austria', 'calling_code': 43, 'currency': 'Euro (€)', 'population': 8}])\r
\r
- from django.template import Template, Context\r
-\r
assert Template("{% for column in countries.columns %}{{ column }}/{{ column.name }} {% endfor %}").\\r
render(Context({'countries': countries})) == \\r
"Name/name Capital/capital Population Size/population Phone Ext./cc "\r
\r
print Template("{% for row in countries %}{% if countries.columns.name.visible %}{{ row.name }} {% endif %}{% if countries.columns.tld.visible %}{{ row.tld }} {% endif %}{% endfor %}").\\r
render(Context({'countries': countries})) == \\r
- "Germany France Netherlands Austria"
\ No newline at end of file
+ "Germany France Netherlands Austria"\r
+\r
+def test_templatetags():\r
+ add_to_builtins('django_tables.app.templatetags.tables')\r
+\r
+ # [bug] set url param tag handles an order_by tuple with multiple columns\r
+ class MyTable(tables.Table):\r
+ f1 = tables.Column()\r
+ f2 = tables.Column()\r
+ t = Template('{% set_url_param x=table.order_by %}')\r
+ table = MyTable([], order_by=('f1', 'f2'))\r
+ assert t.render({'request': HttpRequest(), 'table': table}) == '?x=f1%2Cf2'\r