Hello,

Can anybody tell me what I'm doing wrong here.  I am trying to assign
a min and max value for an integer field in my model below:

from django.db import models
from django.forms import ModelForm

floor_plan_choices = (
        ('A', 'Square'),
        ('B', 'Rectangular'),
        ('C', 'Round'),
)

direction_choices = (
        ('360', '360'),
        ('270', '270'),
        ('180', '180'),
        ('90', '90'),
)

class Customer(models.Model):
    first_name = models.CharField(max_length=30)
    last_name = models.CharField(max_length=40)
    email = models.EmailField()
    email_conf = models.EmailField(verbose_name='Confirm Email')
    year_built = models.IntegerField(min_value=1800, max_value=2100)
    direction = models.DecimalField(max_digits=5, decimal_places=2,
choices=direction_choices)
    floor_plan = models.CharField(max_length=2,
choices=floor_plan_choices)

class CustomerForm(ModelForm):

        class Meta:
                model = Customer

def __unicode__(self):
        return u'%s %s' % (self.first_name, self.last_name)

But I get this error:

TypeError: __init__() got an unexpected keyword argument 'max_value'

Can you not assign min max values to integer fields in Models?  Should
they be assigned in my ModelForm?  If so, how is that done?

Thanks for your help.


--~--~---------~--~----~------------~-------~--~----~
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