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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T08:34:03+00:00 2026-06-06T08:34:03+00:00

I have a simple custom NumberField: class NumberInput(forms.widgets.Input): input_type = ‘number’ class NumberField(forms.DecimalField): def

  • 0

I have a simple custom NumberField:

class NumberInput(forms.widgets.Input):
    input_type = 'number'

class NumberField(forms.DecimalField):
    def __init__(self, *args, **kwargs):
        self.widget = kwargs.get('widget', NumberInput)
        self.min_value = kwargs.get('min', 0)
        self.max_value = kwargs.get('max', 10)
        self.step = kwargs.pop('step', 1)
        super(NumberField, self).__init__(*args, **kwargs)
    def widget_attrs(self, widget):
        attrs = super(NumberField, self).widget_attrs(widget)
        if self.min_value is not None:
            attrs['min'] = self.min_value
        if self.max_value is not None:
            attrs['max'] = self.max_value
        if self.step is not None:
            attrs['step'] = self.step
        return attrs

And I use it in a form as such:

class TimeLog
     time = NumberField(min_value = '0', max_value = '100000', step = '0.25')

Every time I try and submit it, I get the same error, regardless of the input:

Ensure this value is greater than or equal to 0.

The element on page definitely has a valid value:

<input step="0.25" name="time" min="0" max="100000" type="number" id="id_time" value="0.25">

What’s causing this invalidation?

  • 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-06T08:34:09+00:00Added an answer on June 6, 2026 at 8:34 am

    You’re initializing it with strings for min and max value, instead of integers.

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

Sidebar

Related Questions

i'm missing something fundamental here. i have a very simple custom class that draws
I have the following methods in my simple Custom Parser Class, when I execute
I have a simple custom Point class as follows and I would like to
I have two simple custom controls derived from standard WPF controls. I.e. internal class
I have a simple custom view that is connected via outlet to a NIB.
I have a simple form and would like to add a custom jQuery validation
I'm trying to create a custom component to extend PrimeFaces. I have a simple
I have tab controller created through storyboards with a custom implementation (simple buttons and
I have a custom listview and made overlapping very simple: in onDraw method, I
I have the following lines in my ~/.emacs.d/init.el (custom-set-variables '(flymake-allowed-file-name-masks (quote ( (\\.cc\\' flymake-simple-make-init)

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.