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

  • Home
  • SEARCH
  • 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 8940895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:09:53+00:00 2026-06-15T11:09:53+00:00

Django template language has so many features: https://docs.djangoproject.com/en/dev/ref/templates/builtins/?from=olddocs But I’ve been having trouble finding

  • 0

Django template language has so many features:
https://docs.djangoproject.com/en/dev/ref/templates/builtins/?from=olddocs

But I’ve been having trouble finding one. I have a dictionary in python which is sent to the HTML document.

Dictionary: hello = {'a':100, 'b':200, 'c':300, etc:etc}

In the HTML file, if I do this: {{a}} the number 100 is outputted.

Now I was wondering, if it is at all possible to use Django templates to add a character for the 100 and all other values. So like a filter that changes the output from 100 200 300 etc into 10a0 20a0 30a0 etc or even 1.00 2.00 3.00 etc. The closest I’ve found is the add built-in feature {{ value|add:"2" }} so {{ 4|add:"2" }} would give you 6.

Thanks for reading this, I’d appreciate any help!

  • 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-15T11:09:54+00:00Added an answer on June 15, 2026 at 11:09 am

    If you really want to do this in template, here is what you can try:

     {% for d in a|make_list %}{{d}}{%if forloop.counter == 1 %}.{%endif%}{%endfor%}
    

    But this is ugly!

    I would suggest to write a simple template filter to appropriately transform the value.

    For example:

    # sample filter
    def todollars(value):
        val = int(value)
        return "%.2f" % val/100.0
    

    in template use it as:

    {{ a|todollars }}
    

    This would give you value as 1.00 when value is 100.

    More help on how to write, register template filters here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

from django.template import Template, Context template = Template( {% for language in languages %}
I have a basic question, in the Django template language how can you tell
Im trying to render a django template from a database outside of djangos normal
I got a little confusing situation here when I use the Context from django.template.
In a Django template, I need to transanlate some strings to a specific language
Is there a template language for PHP that's almost similar to the Django template
Is there's some global variable for gettin' language code in django template or atleast
I want to use XSLT as a template language in Django project. So the
In Django's template language, you can use {% url [viewname] [args] %} to generate
After using the Django template language, I really miss being able to do things

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.