On Fri, Oct 31, 2008 at 11:55 AM, Frank Peterson
<[EMAIL PROTECTED]>wrote:

>
> 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"?
>

No, there's no way to make the existing cut filter do this, and I don't see
another built-in filter that does what you ask.  However if you look at the
implementation of cut here:

http://code.djangoproject.com/browser/django/tags/releases/1.0/django/template/defaultfilters.py#L325

and the doc for Python's string replace method you can pretty easily write
your own cut_first filter.

Karen

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to