user1940979
user1940979

Reputation: 935

funny DatabaseError

Please can any one tell me why i get this message when saving this model below i have looked around and found people with similar problem but many solutions.

Exception Type:     DatabaseError
Exception Value: value too long for type character varying(10)
Exception Location: /usr/local/lib/python2.7/dist-packages/django/db/backends/postgresql_psycopg2/base.py in execute, line 52


class Stylesheet(models.Model): 
    text_color = models.CharField(max_length = 50,default = '#000')
    a_visited = models.CharField(max_length = 50,default = '#000')
    background = models.CharField(max_length = 50,default = '#000')
    content_background_color = models.CharField(max_length = 50,default= '#000')
    nav_color = models.CharField(max_length = 50,default = '#000')
    nav_background = models.CharField(max_length = 50,default = '#000')
    nav_gradient_start = models.CharField(max_length = 50,default = '#000')
    nav_gradient_end = models.CharField(max_length = 50,default = '#000')
    nav_a_color = models.CharField(max_length = 50,default = '#000')
    nav_a_hover_color = models.CharField(max_length = 50,default = '#000')
    nav_a_hover_background = models.CharField(max_length = 50,default = '#000')
    nav_a_hover_gradient_start = models.CharField(max_length = 50,default = '#000')
    nav_a_hover_gradient_end = models.CharField(max_length = 50,default = '#000')
    slug = models.SlugField(max_length = 255,blank=True,null = True,editable=False)

    class Meta:
            db_table = 'stylesheet'
            verbose_name = 'Style sheet'
            verbose_name_plural = 'Style sheets'

    def __unicode__(self):
            return self.slug

    def save(self):                   
            super(Stylesheet, self).save()

Upvotes: 0

Views: 102

Answers (1)

Matt Busche
Matt Busche

Reputation: 14333

what line in your application is line 52?

The issue seems to be that you've set a character limit of 10 on your database field and you're trying to pass it a value larger than 10

See this SO question for more information Strange PostgreSQL "value too long for type character varying(500)"

Upvotes: 1

Related Questions