Here's a simplified version of what I need to accomplish:

      1 from django.db import models
      2
      3 class Category(models.Model):
      4     name = models.CharField(maxlength=255)
      5     def __str__(self):
      6         return self.name
      7     class Admin: pass
      8
      9 class Listing(models.Model):
     10     name = models.CharField(maxlength=255)
     11     def __str__(self):
     12         return self.name
     13     class Admin: pass
     14
     15 class Location(models.Model):
     16     name = models.CharField(maxlength=255,core=True)
     17     listing = models.ForeignKey(Listing,
edit_inline=models.STACKED, num_in_admin=1)
     18     categories = models.ManyToManyField(Category, blank=True,
null=True)
     19     def __str__(self):
     20         return self.name
     21     class Meta:
     22         ordering = ['listing','id']

Now I have no problem using this model at all from the command line.
However, when I try to save a Listing and Location (the inline FK) with
the categories (M2MField) left BLANK, I get an empty SQL IN () clause
in my error on the POST:

Exception Value:        ERROR: syntax error at or near ")" at character 113
SELECT "vendor_category"."id","vendor_category"."name" FROM
"vendor_category" WHERE ("vendor_category"."id" IN ())

The data is saved fine and I can refresh the page with a GET that
returns proper page. If a value is selected for the categories
(M2MField), then this does not occur.

I had this working in a previous revision of Django 0.95, but it broke
when I updated the revision I'm using.

Any ideas?


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to