I wanted to bring up this bug: https://code.djangoproject.com/ticket/17763 
as it's bitten me on a couple of projects recently

Summarizing the ticket:

==============

Django automatically generates a name that is longer than what the default 
field length can hold.

INSERT INTO "auth_permission" ("name", "content_type_id", "codename") 
VALUES (%s, %s, %s) (u'Can add study plan practice assessment tutorial 
question', 52, u'add_studyplanpracticeassessmenttutorialquestion')

This will fail with a error about it not being able to fit in a varchar(50)

                                     Table "public.auth_permission"
     Column      |          Type          |                          Modifiers  
                         
-----------------+------------------------+--------------------------------------------------------------
 id              | integer                | not null default 
nextval('auth_permission_id_seq'::regclass)
 name            | character varying(50 ) | not null
 content_type_id | integer                | not null
 codename        | character varying(100) | not null

This was under PostgreSQL and after modifying the field to have a length of 
200, I was able to perform the insert.
==============


This is easy to run into, especially when other developers who might make a 
particular model are working in SQLite3, where validation at the db level 
does not happen and values are silently truncated.  It can also happen 
pretty easily when working with legacy database tables with overly verbose 
table names.

The 50/100 char length constraint on name and codename seem to be rather 
arbitrary to me.  I think it seems reasonable to bump these up to 200 or 
255, and provide validation on the lengths to be entered when performing 
syncdb.

I'm happy to work on a patch/tests if there is interest.  For now, when a 
slightly longer class name is needed, the only real way around it is to 
alter the model & the db, which is not ideal.

Thanks in advance!

-greg

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

Reply via email to