﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
24818	models.CharField shouldn't accept a string as max_length	Santiago L	nobody	"
In models.CharField you can define max_length as string and the system check framework doesn't complain ([https://groups.google.com/forum/#!msg/django-users/GS19FwbYfCI/qZXBX3cI2jsJ related mailing list thread]):

{{{
from django.db import models

class Foo(models.Model):
    bar = models.CharField(max_length='16')
}}}

{{{
>>> # following code raises an Exception
>>> obj = Foo(bar='lorem ipsum')
>>> obj.clean_fields()
Traceback (most recent call last):
  File ""<console>"", line 1, in <module>
  File ""/usr/local/lib/python3.4/dist-packages/django/db/models/base.py"", line 1167, in clean_fields
    setattr(self, f.attname, f.clean(raw_value, self))
  File ""/usr/local/lib/python3.4/dist-packages/django/db/models/fields/__init__.py"", line 589, in clean
    self.run_validators(value)
  File ""/usr/local/lib/python3.4/dist-packages/django/db/models/fields/__init__.py"", line 541, in run_validators
    v(value)
  File ""/usr/local/lib/python3.4/dist-packages/django/core/validators.py"", line 280, in __call__
    if self.compare(cleaned, self.limit_value):
  File ""/usr/local/lib/python3.4/dist-packages/django/core/validators.py"", line 319, in <lambda>
    compare = lambda self, a, b: a > b
TypeError: unorderable types: int() > str()
}}}"	Bug	closed	Database layer (models, ORM)	1.8	Normal	fixed		Santiago L	Accepted	1	0	0	0	0	0
