On May 16, 11:32 pm, ajohnsen <asdjohn...@gmail.com> wrote:
> Hello,
>
> I am trying to assign max_value and min_value to a
> PositiveIntegerField in my model but am getting the error:
>
> year_built = models.PositiveIntegerField(min_value=1800,
> max_value=2100)
> TypeError: __init__() got an unexpected keyword argument 'max_value'
<snip>
> Can anyone explain to me what I am doing wrong and how I should be
> assigning max and min values?

It looks like you are confusing form and model fields. The forms
version of IntegerField takes max_value and min_value parameters.
However, models.IntegerField does not take these, hence your error.

Unfortunately, until model validation is available, there's no way of
enforcing this at the model level. You will need to define a modelform
and override the definitino of year_built on the form.
--
DR.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to