If you know the length of the string that you want to cut off the
beginning, you could use slice:
http://docs.djangoproject.com/en/dev/ref/templates/builtins/#slice

Really, though, you might be going about this in a strange way.  It
might be better to use the url tag to get the correct URL that you
want in the first place.  But then, I don't know what you're trying to
do.

-Jeff

On Oct 31, 12:06 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> 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...
>
> 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 [email protected]
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