Many thanks if you can - here's my scenario (django 0.96, python 2.5.2, MySQL5, Mac OSX)
I've got a model with three classes - Article, Topic, and Relevance (see below for more detail). Logically speaking, Articles and Topics have a many-to-many relationship - a topic can contain many articles and an article can belong to many topics. However, I want to record some information about the relationship between the Article and the Topic, so rather than using a ManyToManyField to physically relate them, I use the Relevance class (which logically just stores the weight of the relationship as an integer). The Relevance class also contains a ForeignKey to Article and a ForeignKey to Topic. This establishes the logical many-to-many I need. DB syncs great, I can operate on the classes just fine via the Python command line. But then I want to use the default admin editors to CRUD these entities. Specifically, I want to define my Topics and my Articles and to establish the Relevance between them. So I've made Articles and Topics directly editable via the admin views and made the Relevance editable inline with the Article. However, when I try to edit the Article, I get an error saying I've violated some constraints when inserting into the Relevance table if I don't fully define all the Relevance widgets showing on the screen. The problem is I want the Relevance to be optional - that is, I'm ok if certain Articles don't have any Relevance relations. But I can't seem to do that by default from the admin view if I've got it set up the way you see below. If I take the inline editing out it works just fine (that is, I can edit Articles as expected). Where have I gone wrong? And thanks in advance! -Jef ====================================== from django.db import models from django.contrib.auth.models import User # Create your models here. class Article(models.Model): name = models.CharField(maxlength=200) content = models.TextField(blank=True, core=False) created = models.DateTimeField(auto_now_add=1) def __str__(self): return self.name class Admin: pass class Topic(models.Model): name = models.CharField(maxlength=64) def __str__(self): return self.name class Admin: pass class Relevance(models.Model): value = models.IntegerField() topic = models.ForeignKey(Topic) article = models.ForeignKey(Article, edit_inline=models.TABULAR, num_in_admin=3) created = models.DateTimeField(auto_now_add=1) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---