Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9136689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:59:09+00:00 2026-06-17T08:59:09+00:00

In a Django template how do I remove the first Zero from all the

  • 0

In a Django template how do I remove the first Zero from all the this mobile numbers I’m displaying. In Python I have tried this but with no success….

{% for object in data %}

   {{ object.mobile.lstrip('0') }}

{% endfor %}



views.py


def sms(request, incentive):
    objectQuerySet = Recipient.objects.filter(incentiveid=incentive)
    context = {'data':objectQuerySet}

    return render_to_response('smssend.html', context, context_instance=RequestContext(request))
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T08:59:09+00:00Added an answer on June 17, 2026 at 8:59 am

    You should pass your data to your template in the correct format. Django templates are not “Python interspersed with HTML” like PHP is.

    For example, when you first pass your data in your view, you should make sure that it is an iterable with the zeroes already stripped.

    There is no lstrip in the Django template mini-language.

    Edit: If you know that the first digit will always be a 0, you can also do this:

    {{ object|slice:"1:" }}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a django template page, and want a link from this page, containing
I would like to use django template for e-mail sending. But I should have
I'm using Django 1.4 with Python 2.7 on Ubuntu 12.04. I have a template
I am using django and python. In the template file, I have a drop-down
I'm using Django 1.4 with Python 2.7 on Ubuntu 12.04. I have a template
Django has a template tag that allows you to remove certain html tags from
I have image files from: imgage = models.ImageField(upload_to=site_media/media) but if I display this photos
i have a django template - one that is normally loaded via a standard
I have a Django template that I want to extend in multiple places. In
Im trying to render a django template from a database outside of djangos normal

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.