Opened 11 years ago

Closed 11 years ago

#21016 closed Uncategorized (invalid)

IntergerField not working? Confusing documentation?

Reported by: anonymous Owned by: nobody
Component: Uncategorized Version: 1.6-beta-1
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I've read from the docs, that I can declare in my model IntegerFields with optional arguments:
max_value
min_value

In: https://docs.djangoproject.com/en/dev/ref/forms/fields/#integerfield

So I tried to make a model with the field:

my_number = models.IntegerField(verbose_name=u"Integer between 1 and 100", min_value=1, max_value=100, blank=True, null=True)

Then I got the error:

my_number = models.IntegerField(verbose_name=u"Integer between 1 and 100", min_value=1, max_value=100, blank=True, null=True)
TypeError: init() got an unexpected keyword argument 'max_value'

If I am doing something wrong, I think the doc should be improved.

Change History (1)

comment:1 by Ramiro Morales, 11 years ago

Resolution: invalid
Status: newclosed

Actually yes, you are doing something wrong but it doesn't warrant improving the documentation in this particular case because you are following the wrong piece of documentation (form fields) to create model fields.

See https://docs.djangoproject.com/en/dev/ref/models/fields/ and https://docs.djangoproject.com/en/dev/ref/models/fields/#integerfield

Also, if you differences between both concepts are fuzzy then you might want to start with the tutorials.

Note: See TracTickets for help on using tickets.
Back to Top