Hi,
I'm encountering the following problem with a token in my custom template tag:
Request Method: GET
Django Version: 1.7
Exception Type: ValueError
Exception Value:
need more than 2 values to unpack
Exception Location: C:\landy\cresta\flow\templatetags\flow_extras.py in rowcolour, line 7
Here is the template file:
from django import template
from datetime import datetime, timedelta
register = template.Library()
@register.tag
def rowcolour(parser, token):
nm, dt, fmt = token.split_contents() # this is line 7
diff = datetime.now() - dt
if diff.days > 14:
return "pinkrow"
else:
return "greyrow"
... here is the line in the html file:
<tr id="{% rowcolour flow.created %}">
... and "created" is defined as follows in the model:
created = models.DateTimeField(db_index=True, auto_now_add=True)
I'm trying to extract the datetime from the token. Any ideas?
Thanks.