Here is my information: johny...@gmail.com
the following is the description of the ticket:
Title:
mysql complains of empty IN() when manytomany field is being saved as
blank/empty
Description:
Django complains when I try to create a concert with an edit_inlined
performance, but do not select a subscription package.
I've tried it with r3739 and r3954(trunk at the time) with MySQL 4.1.20.
I've confirmed that it works with sqlite, but mysql doesn't seem to
like the empty IN().
There is the mysql error message:
{{{
'SELECT `events_subscriptionpackage`.`id`,`events_subscriptionpackage`.`name`,`events_subscriptionpackage`.`slug`,`events_subscriptionpackage`.`teaser`,`events_subscriptionpackage`.`body`,`events_subscriptionpackage`.`feature_on_homepage`,`events_subscriptionpackage`.`feature_in_spotlight`,`events_subscriptionpackage`.`weight`,`events_subscriptionpackage`.`sold_out`
FROM `events_subscriptionpackage` WHERE
(`events_subscriptionpackage`.`id` IN ())'
}}}
{{{
#!python
from django.db import models
from django.http import HttpResponse
from django.template import Context, loader
from django.utils.dateformat import DateFormat
class Concert(models.Model):
name = models.CharField(maxlength=50, core=True)
slug = models.SlugField('Friendly URL', unique=True,
prepopulate_from=('name',))
location = models.CharField(maxlength=50)
body = models.TextField(blank=True, null=True)
created = models.DateTimeField('Date Created', auto_now_add=True)
modified = models.DateTimeField('Date Last Modified', auto_now=True)
def __str__(self):
return "%s" % (self.name,)
class SubscriptionPackage(models.Model):
name = models.CharField(maxlength=100, core=True)
slug = models.SlugField(unique=True, prepopulate_from=('name',))
body = models.TextField(blank=True, null=True)
weight = models.IntegerField(help_text='Lower weights show up
earlier in lists. If items have the same weight, they are sorted by
name.', default=0, choices=weight_options)
sold_out = models.BooleanField(default=False)
def get_absolute_url(self):
return '/events/packages/%s' % (self.slug,)
def __str__(self):
return self.name
class Performance(models.Model):
subscription_packages = models.ManyToManyField(SubscriptionPackage,
core=False, null=True, blank=True)
date = models.DateTimeField(core=True)
concert = models.ForeignKey(Concert, edit_inline=True, min_num_in_admin=3)
def __str__(self):
if not self.concert:
return "%s" % (DateFormat(self.date).format('F d, Y P'),)
return "%s %s" % (self.concert.name,
DateFormat(self.date).format('F d, Y P'),)
class Meta:
get_latest_by='date'
}}}
--
John Hwang
> mysql complains of empty IN() when manytomany field is being saved as
> blank/empty
This looks to be a variation on ticket #2473. It's a known problem,
which I believe Malcolm is working on with his refactor of the query
code.
Yours,
Russ Magee %-)