I am trying schemamigration with south on my model
(I am using django 1.4 and python 2.6 on ubuntu)
Initially my model was
class Review(models.Model):
reviewdate=models.DateField(default=date.today)
description=models.TextField()
author=models.ForeignKey(User,null=True)
I added a field
from django.core.validators import MinValueValidator,MaxValueValidator
class Review(models.Model):
reviewdate=models.DateField(default=date.today)
description=models.TextField()
author=models.ForeignKey(User,null=True)
rating = models.IntegerField(MinValueValidator(1),MaxValueValidator(10),default=5,help_text='integers 1 to 10')
when I run
python manage.py schemamigration myapp --auto
I get this TypeError
...
File "/home/me/Django-1.4/django/db/models/base.py", line 198, in __new__
new_class._prepare()
File "/home/me/Django-1.4/django/db/models/base.py", line 255, in _prepare
cls.__doc__ = "%s(%s)" % (cls.__name__, ", ".join([f.attname for f in opts.fields]))
TypeError: Error when calling the metaclass bases
sequence item 6: expected string, MaxValueValidator found
Can someone please tell me where I am wrong?
Your syntax is incorrect. You should provide the validators as a list to the
validatorsargument:For more information, see the docs for using validation in practice.