﻿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
24677	models.TextField cleaning doesn't behave the same as models.CharField.	Keryn Knight	Rolo	"For brevity's sake, I'm avoiding constructing whole model instances below, but the issue remains the same when they are attached.
{{{
>>> from django.db.models.fields import CharField, TextField
>>> CharField().to_python(1)
u'1'   # type: unicode
>>> TextField().to_python(1)
1   # type: int
}}}
I'd expect that cleaning a `TextField` ought to result in a str/promise/smart_text as with CharField. The issue arises I believe because [https://github.com/django/django/blob/b5e0eede406633b88c6222031171f80876d8f5e1/django/db/models/fields/__init__.py#L2121 TextField implements `get_prep_value`] but not `to_python`, while `CharField` implements [https://github.com/django/django/blob/b5e0eede406633b88c6222031171f80876d8f5e1/django/db/models/fields/__init__.py#L1105 to_python] which is called by `get_prep_value`. Both fields seem to exhibit the same behaviour for the `get_prep_value`:
{{{
>>> CharField().get_prep_value(1)
u'1'  # type: unicode
>>> TextField().get_prep_value(1)
u'1'  # type: unicode
}}}

From a cursory play in  [https://github.com/kezabelle/django-strictmodels/commit/1acad9ef63769fc6378c6d023333259c2a8cc41f#diff-4a6a4e7167b55119eefda4da703221edR160 my toy project], it seems like hoisting the `TextField.get_prep_value` logic into `to_python` and calling it from `get_prep_value` like `CharField` does would make the behaviour consistent."	Bug	closed	Database layer (models, ORM)	dev	Normal	fixed		django@…	Accepted	0	0	0	0	0	0
