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 7942303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:55:53+00:00 2026-06-03T23:55:53+00:00

I tried integer zero in a input field (IntegerField), however that zero never appears

  • 0

I tried integer zero in a input field (IntegerField), however that zero never appears to be show after submit.

This is part of my template:

{{user_date_table.june_11}}
{% if not user_date_table.june_11_steps %}
 <form action="/steps_count/index/{{ username }}/table/" method="post">
  {% csrf_token %}              
  <input type="text" autocorrect="off" autocapitalize="off" name="june_11_steps"/>
  <input type="submit" value="Add"/>
 </form>
{% else %}      
 {{user_date_table.june_11_steps}}
{% endif %}

I think that if not user_date_table.june_11_steps throws “True”, i.e. it is blank if I use zero as input. Is this correct, and can I overcome this?

  • 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-03T23:55:55+00:00Added an answer on June 3, 2026 at 11:55 pm

    In python, all of the following are evaluated as False:

    '', "", 0, [], {}, (), False, None 
    

    So, user_date_table.june_11_steps is 0, then {% if not user_date_table.june_11_steps %} will be evaluated True and that block will be executed.

    UPDATE: For solution,

    1. If user_date_table do not take place in your context while you display the form, or if it is empty, you can use

      {% if not user_date_table%}
      
    2. Pass another value to your template, like display_result, and use that to check which fieldset will be displayed.

    views.py:

    if request.POST: #saving the post data
        display_result = True
    

    template.html

    {% if not display_result %}
        <form action="/steps_count/inde...
    

    But the first approach is always better.

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

Sidebar

Related Questions

I need a custom widget height. I tried using this Integer.toString(yourWidget.getElement().getOffsetHeight()) but, If I
My understanding of the Integer.TryParse() function was that it tried to parse an integer
I know that for an integer, you can use: int value; I tried: string
I have taken an integer input and tried to reverse it in Python but
Tried this: $('.link').click(function(e) { $.getScript('http://www.google.com/uds/api?file=uds.js&amp;v=1.0', function() { $('body').append('<p>GOOGLE API (UDS) is loaded</p>'); }); return
I have a [Range] annotation that looks like this: [Range(0, 100)] public int AvailabilityGoal
There're two well-known ways to set an integer register to zero value on x86.
I'm trying to write a program in Haskell that gets a list (of integer)
I have a field in a SQL Server table that is of type bit
I accidentally tried to insert 'asdf' into an integer column. It worked (put 0

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.