List Info

Thread: textarea size




textarea size
user name
2006-07-28 15:30:50
Is there any way in models.TextField to specify the number
of
rows/columns that the <textarea> uses?

Josh

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

textarea size
user name
2006-07-28 15:39:39
On 7/28/06, Josh Trutwin <joshtrutwins.homeip.net>
wrote:
> Is there any way in models.TextField to specify the
number of
> rows/columns that the <textarea> uses?

Hi Josh,

Nope, there's no way to specify that in the model, but you
can target
the field's form field using CSS. The textarea will have an
HTML ID
called "id_foo", where "foo" is the
name of your field. You can edit
the admin templates to add custom CSS like this:

    #id_foo { width: 300px; height: 400px; }

Adrian

-- 
Adrian Holovaty
holovaty.com | djangoproject.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

textarea size
user name
2006-07-28 15:40:23
Maybe you can change it with CSS.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

textarea size
user name
2006-07-28 16:08:14
If you are creating your own manipulator and using that you
can use the
form field LargeTextField where you can specify the row and
columns.

class LargeTextField(TextField):
 	    def __init__(self, field_name, rows=10, cols=40,
is_required=False, validator_list=None, maxlength=None):

Otherwise, css is the best option. 

Chris


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

textarea size
user name
2006-07-28 16:25:24
On Fri, 28 Jul 2006 16:08:14 -0000
"indirecthitgmail.com" <indirecthitgmail.com> wrote:

> 
> If you are creating your own manipulator and using that
you can
> use the form field LargeTextField where you can specify
the row
> and columns.
> 
> class LargeTextField(TextField):
>  	    def __init__(self, field_name, rows=10, cols=40,
> is_required=False, validator_list=None,
maxlength=None):
> 
> Otherwise, css is the best option. 

Thanks for the replies - I'm not a big fan of mucking with
the css
or anything in the django source tree so my solution was
close to
this - in models.py I created a subclass of
django.forms.LargeTextField and
django.db.models.fields.LargeTextField:

from django.forms import LargeTextField
from django.db.models.fields import TextField

class MyLargeTextField(LargeTextField):
   def __init__(self, *args, **kwargs):
      kwargs['rows'] = 3
      kwargs['cols'] = 60
      LargeTextField.__init__(self, *args, **kwargs)

class MyTextField(TextField):
   def get_manipulator_field_objs(self):
      return [MyLargeTextField]

class SomeData:
   stuff = MyTextField('Some Stuff')

I'm not particularily happy with this either as it'd be
nice to
have the rows/cols be params that can be passed in.

Josh

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

textarea size
user name
2006-07-29 01:32:51

On 28-Jul-06, at 9:00 PM, Josh Trutwin wrote:

> Is there any way in models.TextField to specify the
number of
> rows/columns that the <textarea> uses?

it is hardcoded in the css - change it there

-- 

regards
kg
http://lawgon.livejourn
al.com
http://nrcfosshelpline
.in/web/



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

[1-6]

about | contact  Other archives ( Real Estate discussion Medical topics )