Re: ForeignKey on CharField and char operations

2012-07-05 Thread Serg Shtripling
четверг, 5 июля 2012 г., 20:40:00 UTC+7 пользователь Tomas Neme написал: > > I might not be understanding this fully, but what about > A.objects.filter(type__mnemo__startswith="type1")? > > Wouldn't it create INNER JOIN query on a_type table? AFAIR it would and it's a bit overhead. But surely

ForeignKey on CharField and char operations

2012-07-05 Thread Serg Shtripling
Hello, community! Have anyone tried this: class AType(models.Model): #cut mnemo = models.CharField(u'Mnemocode', max_length=31, null=True, unique=True) class A(models.Model): #cut type = models.ForeignKey(AType, 'mnemo', verbose_name=u'A Type', null=True) class B(models.Model):