Code

Changes between Initial Version and Version 1 of Ticket #8548


Ignore:
Timestamp:
08/25/08 17:16:46 (6 years ago)
Author:
mtredinnick
Comment:

(Fixed description. The preview button is your friend.)

This problem should be caught by the validate command for django-admin.py. That's the most logical fix.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #8548

    • Property Patch needs improvement unset
    • Property Component changed from Database wrapper to django-admin.py
    • Property Needs tests unset
    • Property Milestone changed from to post-1.0
    • Property Needs documentation unset
    • Property Triage Stage changed from Unreviewed to Accepted
  • Ticket #8548 – Description

    initial v1  
     1{{{ 
     2#!python 
    13class Thingie(models.Model) 
    24#fields go here 
    35  class Meta: 
    46    verbose_name = 'A String Greater Than 50 Characters Long, Probably For The Admin' 
     7}}} 
    58 
    69Running 'python manage.py syncdb' results in MySQLdb trying to run the following: 
    7  
     10{{{ 
     11#!sql 
    812INSERT INTO `auth_permission` (`name`, `content_type_id`, `codename`) VALUES (%s, %s, %s)(u'A String Greater Than 50 Characters Long, Probably For The Admin', 11, u'add_thingie') 
     13}}} 
    914 
    1015The field `name` has a length restriction of 50 characters.  This results in a warning 'error' being generated (_mysql_exceptions.Warning: Data truncated for column 'name' at row 1) but no further useful information.  This also halts syncdb, which is also called during the test suite. 
    1116 
    1217Suggestions (since I'm nowhere near qualified to contribute, yet): 
    13 - Maybe just catch the warning and ignore it?  This seems to be a display-only field, so it probably won't hurt. 
    14 - Or maybe catch the warning and explain the cause? 
    15 - Model validator could complain about verbose_name being too long? 
    16 - Increase the size of the field? 
    17 - Maybe just let google index this ticket so that the next person to google the error sees why it happened? 
     18 - Maybe just catch the warning and ignore it?  This seems to be a display-only field, so it probably won't hurt. 
     19 - Or maybe catch the warning and explain the cause? 
     20 - Model validator could complain about verbose_name being too long? 
     21 - Increase the size of the field? 
     22 - Maybe just let google index this ticket so that the next person to google the error sees why it happened? 
    1823 
     24{{{ 
    1925Traceback (most recent call last): 
    2026  File "manage.py", line 11, in <module> 
     
    6369    raise message 
    6470_mysql_exceptions.Warning: Data truncated for column 'name' at row 1 
     71}}}