stringformat to get first 3 characters?

2009-06-11 Thread Frank Peterson

I need to use the stringformat filter on a variable in a template but
I just want it to grab the first 3 characters of the variable.

{{ object.caption|lower|truncatewords:"1"|stringformat:"3s" }}

Doesnt seem to work.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



IFEQUAL takes two arguments error on Django 0.91

2009-06-10 Thread Frank Peterson

I'm on Django 0.91 (unfortunately we are stuck with that and cannot
upgrade).

We have a variable - object.caption and lets say that it equals
"Bling: whatever" (without the quotes)

I am doing a hack in the templates (dont have access to anything else,
and need to output "IT WORKED!" (without the quotes)

I am using the following code

{% ifequal object.caption|lower|truncatewords:"1"|cut:": ..." "bling"
%}IT WORKED!{% endifequal %}

It gives me "bling" when I output this {{ object.caption|lower|
truncatewords:"1"|cut:": ..." }}
however as soon as that code is in the ifequal it errors and says

IFEQUAL takes two arguments error
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Is there a way to use the Cut Filter to only do the first instance?

2008-10-31 Thread Frank Peterson

I am using the following
{{ section.get_absolute_url|cut:"/news/" }}
on a string that is
/news/new-york-jets/news/

I need to remove the first /news but the CUT filter removes all
instances of it, is there a way for me to remove on the first "/news"?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Parsing through feed to get to enclosure data?

2008-10-16 Thread Frank Peterson

I have a RSS feed and I need to be able to get to the enclosure data
out of it.
Our code loads libRSS, here is what I have so far and its not working


{% for itm in rss.items %}

{{itm.description}}
FLV

{% endfor %}


Here is what my feed looks like.


http://www.w3.org/2005/Atom; version="2.0">

Videos Feed
http://example.com/
http://example.com/; type="application/rss+xml"
rel="self">
Videos from Example.com
en-us
football



http://example.com/videos/detail/hawks-roll-homecoming-victory
img src="http://media.example.com/albany/content/img/
videothumbs/2008/10/18/albany.jpg" alt="hawks homecoming victory"
align="left" hspace="10" / The Albany High Hawks remained
undefeated with a 33-3 homecoming victory over Ford.
http://example.com/videos/detail/hawks-homecoming-victory
http://web.example.com/static/content/video/
albany_wrapup.flv" length="3888010" type="video/x-flv">




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



ifequal doesn't like spaces?

2008-10-15 Thread Frank Peterson

I have something like the following

{% ifequal flatpage.title "Special Reports" %}
http://example.com/icon_specialreports.png; />
{% endifequal %}

I get the error
'ifequal' takes two arguments
so it doesn't like the fact that "Special Reports" has a space in it.

Is there a way around this?

I'm on Django 0.91 (I cannot upgrade, because it's our corporate
system and they have to upgrade it).
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Is there a TRIM feature for templates in Django 0.91

2007-09-19 Thread Frank Peterson

TRIM would delete any whitespace from the string (tabs, newlines,
spaces, ...). SPACELESS comes close as it will convert all the
whitespace into just 1 space.

I'm stuck on 0.91 at work and I dont think they plan on upgrading
anytime soon (its beyond my control)

I'm not sure SPACELESS doesnt work, maybe because its around the
variable story.tease?  I cant do anything via python either, I dont
have permission and I wouldnt know how anyway, all I deal with is
templates

{% block data %}{% spaceless %}{{ story.tease }}{% endspaceless %}
{%endblock %}


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Is there a TRIM feature for templates in Django 0.91

2007-09-18 Thread Frank Peterson

I looked over the docs
http://www.djangoproject.com/documentation/0_91/templates/

but the closest thing was SPACELESS

I tried to use it like this:
{% block data %}{% spaceless %}{{ story.tease }}{% endspaceless %}{%
endblock %}

But it didnt work.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How do I Sort Years in Template

2007-05-23 Thread Frank Peterson

thanks, I had to use dictsortreversed and that puts them in newest
year first :)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



How do I Sort Years in Template

2007-05-01 Thread Frank Peterson

Story archive

{% for date in date_list %}
{{ date.year }}
{% endfor %}


Not sure how to do this


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---