This would be something to use a template filter for, you can either
use one of the built in ones: 
http://www.djangoproject.com/documentation/templates/#built-in-filter-reference
if it exists, or you could write your own.

On Jan 21, 10:44 pm, "Oak McIlwain" <[EMAIL PROTECTED]> wrote:
> ... lol.
>
> I'm pretty sure you know what I mean now but I'll clarify it anyway:
>
> When I say "in a template" I mean "within the code in a Django template"
> (Not within a text editor). As far as I know this is limited to a set of
> Django specific commands.
>
> I have a string variable and I want to replace all the instances of a
> specific string within this variable with another specific string.
>
> I know I could do the operation in the view but it's such a simple thing
> that it doesn't make sense to me to do it that way.
>
> I hope that is more clear =]
>
> -----Original Message-----
> From: django-users@googlegroups.com
>
> [mailto:[EMAIL PROTECTED] On Behalf Of Russell Keith-Magee
> Sent: Tuesday, 22 January 2008 12:39 PM
> To: django-users@googlegroups.com
> Subject: Re: Replace function within template?
>
> On Jan 22, 2008 11:18 AM, oak <[EMAIL PROTECTED]> wrote:
>
> > Is it possible to perform a replace operation in a template? I
> > couldn't find any reference to it.
>
> My text editor has a magnificent Replace operation. It can replace any
> text with any other text. It even allows you to use regular
> expressions to specify the text you want to replace.
>
> Oh - that wasn't what you meant?
>
> You know, when you're asking someone for help, it sometimes helps to
> elaborate a little on the problem you're having. "Replace operation"
> is a fairly ambiguous term. If you can't find a reference to "Replace"
> in the documentation, it might be because we use a different term to
> describe the feature, or it could be because Django encourages you to
> look at the problem in a different way ... unless we know what it is
> you are trying to do, nobody is going to be able to help.
>
> So - care to tell us what it is you want to do?
>
> Yours,
> Russ Magee %-)
>
> Disclaimer:
> Please note that during Western Australian daylight savings time RWWA 
> appointment times and email send times are based on GMT+9.
> If in doubt, we recommend you confirm appointment times.
>
> 1. The contents of this email and its attachments are confidential and 
> privileged. Any unauthorised use, or passing on, of the information to others 
> who are not authorised is expressly prohibited. If you receive this email in 
> error, please advise us and then delete the email with any attachments.
>
> 2. Before opening or using attachments, check them for viruses and defects. 
> The contents of this email and its attachments may become scrambled, 
> truncated or altered in transmission. Please advise us of any anomalies.
>
> 3. Racing & Wagering WA's liability  is limited to resupplying the email and 
> attached files or the cost of having them resupplied.
>
> 4. The views represented in this email are those of the author and do not 
> necessarily represent those of Racing & Wagering WA unless this is clearly 
> indicated.
--~--~---------~--~----~------------~-------~--~----~
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