﻿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
872	fields.TextField should pass 'rows' argument to its formfields.LargeTextField	garthk	Adrian Holovaty	"It takes me twenty lines of code to pass a 'rows' argument from my model definition to the admin display: 

{{{
from django.core import meta, formfields
from django.utils.functional import curry

class HeightAdjustableTextField(meta.TextField):
    """"""A TextField with adjustable rows.""""""

    def __init__(self, *args, **kwargs): 
        """"""Initialise the HeightAdjustableTextField.""""""
        # Default row count is from django.core.formfields.LargeTextField.
        # Popping removes the keyword argument, if present. 
        self.rows = kwargs.pop('rows', 10) 
        meta.TextField.__init__(self, *args, **kwargs)

    def get_manipulator_field_objs(self):
        return [curry(formfields.LargeTextField, rows=self.rows)]
  
meta.HeightAdjustableTextField = HeightAdjustableTextField

class Post(meta.Model): 
    # ...
    tease = meta.HeightAdjustableTextField(rows=3, blank=True)
}}}

Making {{{django.core.meta.fields.TextField}}} three lines longer will save me all that code:

{{{
class TextField(Field):
    def __init__(self, *args, **kwargs):
        self.edit_rows = kwargs.pop('rows', 10)
        Field.__init__(self, *args, **kwargs)
    def get_manipulator_field_objs(self):
        return [curry(formfields.LargeTextField, rows=self.edit_rows)]
}}}"	enhancement	closed	contrib.admin	0.91	normal	wontfix			Unreviewed	0	0	0	0	0	0
