1

When I post a value from my page an extra string is create and I would like to remove the 'pattern = "' is there a tag i could use or replace function i can use to remove pattern =" and the ending ". Please find below scenario:

pattern = "apple"

Desired output

apple

I tried using but to no success.Is there another method i could use newbie at django python.

{{ pattern|split }}

1
  • if You know that is the pattern, can you not parse it in the view and send it to the template in the context ? Commented Apr 19, 2013 at 12:38

2 Answers 2

1

Write a custom templatetag and use a regular expression (a capture group would do the trick) to replace the desired part.

Sign up to request clarification or add additional context in comments.

Comments

0

If the quotation marks are added to your string when you are submitting the form, you could use the .strip() method when accessing the POST data. You can also specify what characters you want to remove. Check it out here: http://docs.python.org/2/library/stdtypes.html

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.