Hi,
I'm encountering the following problem with a token in my custom template 
tag:
Request Method: GET
Request URL: http://127.0.0.1:8000/flows/
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.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2febd7e9-7f50-4741-bd4a-a82ca597f22c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to