]> git.parisson.com Git - telecaster-client.git/commitdiff
fix comment size
authoryomguy <yomguy@parisson.com>
Mon, 5 Mar 2012 15:43:11 +0000 (16:43 +0100)
committeryomguy <yomguy@parisson.com>
Mon, 5 Mar 2012 15:43:11 +0000 (16:43 +0100)
telecaster/models.py

index ba4bfaa233ce177fe26162544b42746767c68521..6dd369a5f1d26cca5e777e4cc8831155ae96fe42 100644 (file)
@@ -48,9 +48,11 @@ from mutagen.id3 import ID3, TIT2, TP1, TAL, TDA, TDAT, TDRC, TCO, COM
 
 import django.db.models as models
 from django.db.models import *
-from django.forms import ModelForm
+from django.forms import ModelForm, TextInput, Textarea
 from django.utils.translation import ugettext_lazy as _
 
+from south.modelsinspector import add_introspection_rules
+
 app_label = 'telecaster'
 
 
@@ -118,6 +120,16 @@ class Professor(Model):
         db_table = app_label + '_' + 'professor'
 
 
+class ShortTextField(models.TextField):
+
+    def formfield(self, **kwargs):
+         kwargs.update(
+            {"widget": Textarea(attrs={'rows':3, 'cols':30})}
+         )
+         return super(ShortTextField, self).formfield(**kwargs)
+
+add_introspection_rules([], ["^telecaster\.models\.ShortTextField"])
+
 class Station(Model):
 
     organization      = ForeignKey(Organization, related_name='stations', verbose_name='organization',
@@ -131,7 +143,7 @@ class Station(Model):
     professor         = ForeignKey(Professor, related_name='stations', verbose_name='professor',
                                    null=True, blank=True, on_delete=models.SET_NULL)
     professor_free    = CharField(_('professor'), max_length=255, blank=True)
-    comment           = TextField(_('comment'), blank=True)
+    comment           = ShortTextField(_('comments'), blank=True)
     started           = BooleanField(_('started'))
     datetime_start    = DateTimeField(_('time_start'), blank=True, null=True)
     datetime_stop     = DateTimeField(_('time_stop'), blank=True, null=True)