i have a model as below (please follow the red color lines)
class NewsEntry(models.Model) :
url = models.URLField(max_length=1024,db_index=True)
title = models.CharField(max_length=1024)
-------------
thereafter i ran
python manage.py syncdb
i am getting the following error
Failed to install index for pystories.NewsEntry model: Specified key
was too long; max key length is 767 bytes
----------------
i understood that the problem is with max_length of the URL.
if i change it 255 everthing was going on fine.
--------------------
But As per the requirement URL should be of length 1024
so what did is ?
1) kept the length to 1024
2) Executed the following command on database
CREATE INDEX urlindex ON pystories_newsentry(url(255));
------------------------
Can i specify the same thing (i.e) creation of index on URL(255)
instead of 1024 in model class NewsEntry itself instead of going
to database and running the command (CREATE INDEX urlindex ON
pystories_newsentry(url(255));) ?
--rama
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---