Thursday, December 6, 2012

Re: How to introduce a text area as a field of a database entry

CharField is for "short" strings mostly under 255 of length. TextField is for "unlimited" text (the length depends of the database engine). If you just want a textarea for the CharField then you will need to replace the default widget. You'll need to read a little about Forms to change the widget of the field (https://docs.djangoproject.com/en/1.4/ref/forms/widgets/) and the Admin interface to see how to set a custom Form.

El jueves, 6 de diciembre de 2012 08:18:38 UTC-3, joy escribió:
My model.py

##model.py
from django.db import models

class Text(models.Model):
           pag= models.CharField(max_length=10)  
           content = models.CharField(max_length=500) 
##should i put something different in the previous line to have a textarea in the admin view of this field?

           def __unicode__(self):
                       return self.pag

thanks Joy

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/b1OPVXYJ-WMJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate