Hi Karen,

I like to use NaviCat for MySQL and I recreated my database using the
default collation, which did not add a binary collation. I don't see
an option in the database creation menu for utf8_general_ci in NaviCat
though.

I just need a chance to repopulate the DB and I'll try my search
again. Thank you very much for helping! I really appreciate your time.

Brandon

On Apr 9, 3:54 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Wed, Apr 9, 2008 at 4:35 PM, Brandon Taylor <[EMAIL PROTECTED]>
> wrote:
>
>
>
>
>
> > Here's the output from the 'portfolio_workcategory' table create:
>
> > -- Table "portfolio_workcategory" DDL
>
> > CREATE TABLE `portfolio_workcategory` (
> >  `id` int(11) NOT NULL auto_increment,
> >  `title` varchar(30) collate utf8_bin NOT NULL,
> >  `position` smallint(5) unsigned NOT NULL,
> >  PRIMARY KEY  (`id`)
> > ) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8
> > COLLATE=utf8_bin;
>
> > I'm assuming the "COLLATE=utf8_bin" is what's causing the problem?
>
> Yes, collations that end in _bin are binary, and that's what is making
> Django's LIKE search case-sensitive.  (Django's MySQL backend assumes a
> default non-case-sensitive collation is in effect.)  If you want to be able
> to do case-insensitive searching with Django code then you want a collation
> like utf8_general_ci.  You mentioned before that when you created the
> database you specified a default unicode character set, but nothing else.
> That would seem to imply your database server has a default collation set to
> utf8_bin, otherwise I don't understand how that collation got attached to
> your table and its title column.  Can you recreate your database specifying
> COLLATE=utf8_general_ci?
>
>  Karen
>
> > Thanks,
> > Brandon
>
> > On Apr 9, 3:14 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> > > On Wed, Apr 9, 2008 at 3:31 PM, Brandon Taylor <[EMAIL PROTECTED]>
> > > wrote:
>
> > > > Hi Karen,
>
> > > > Here's an example of one of the models in question:
>
> > > > class WorkCategory(models.Model):
> > > >        title = models.CharField(max_length = 30)
> > > >        position = models.PositiveSmallIntegerField()
>
> > > >        def __unicode__(self):
> > > >                return self.title
>
> > > >        class Admin:
> > > >                ordering = ('position',)
> > > >                search_fields = ('title')
>
> > > >        class Meta:
> > > >                verbose_name_plural = 'Work Categories'
>
> > > > When I created the database, I specified the default character set as
> > > > unicode, but other than that, I haven't made any changes to the
> > > > database. I actually haven't even touched it directly, only through
> > > > the Python code in Django.
>
> > > Does your database server have a default binary collation defined?  From
> > a
> > > mysql command prompt, enter "use your_database_name" then "show
> > variables
> > > like 'coll%;'  to see the default collations for the connection,
> > database,
> > > and server.  For good measure you can look at the output of "show create
> > > table your_table_name;" to see if there are binary collations associated
> > > with the table's columns.
>
> > > If none of those show that you've somehow got a binary collation
> > associated
> > > with this table, then I'm baffled.
>
> > > Karen
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to