Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat does this error mean: The model User has two manually-defined m2m relations
    primarykey
    data
    text
    <p>I'm running into this error when I attempt to syncdb:<br> auth.user: The model User has two manually-defined m2m relations through the model FavoriteQuestion, which is not permitted. Please consider using an extra field on your intermediary model instead.</p> <p>I'm really don't understand what it means because I only see 1 model-to-model relations in the model FavoriteQuestion.</p> <pre><code>class FavoriteQuestion(models.Model): """A favorite Question of a User.""" question = models.ForeignKey(Question) user = models.ForeignKey(User, related_name='user_favorite_questions') added_at = models.DateTimeField(default=datetime.datetime.now) class Meta: db_table = u'favorite_question' def __unicode__(self): return '[%s] favorited at %s' %(self.user, self.added_at) </code></pre> <p>I'm not sure if this is important, but this is also in the models.py file. </p> <pre><code>User.add_to_class('favorite_questions', models.ManyToManyField(Question, through=FavoriteQuestion, related_name='favorited_by')) </code></pre> <h1>edit added Question model</h1> <p>Django 1.1.1</p> <pre><code>class Question(models.Model): title = models.CharField(max_length=300) author = models.ForeignKey(User, related_name='questions') added_at = models.DateTimeField(default=datetime.datetime.now) tags = models.ManyToManyField(Tag, related_name='questions') # Status wiki = models.BooleanField(default=False) wikified_at = models.DateTimeField(null=True, blank=True) answer_accepted = models.BooleanField(default=False) closed = models.BooleanField(default=False) closed_by = models.ForeignKey(User, null=True, blank=True, related_name='closed_questions') closed_at = models.DateTimeField(null=True, blank=True) close_reason = models.SmallIntegerField(choices=CLOSE_REASONS, null=True, blank=True) deleted = models.BooleanField(default=False) deleted_at = models.DateTimeField(null=True, blank=True) deleted_by = models.ForeignKey(User, null=True, blank=True, related_name='deleted_questions') locked = models.BooleanField(default=False) locked_by = models.ForeignKey(User, null=True, blank=True, related_name='locked_questions') locked_at = models.DateTimeField(null=True, blank=True) # Denormalised data score = models.IntegerField(default=0) vote_up_count = models.IntegerField(default=0) vote_down_count = models.IntegerField(default=0) answer_count = models.PositiveIntegerField(default=0) comment_count = models.PositiveIntegerField(default=0) view_count = models.PositiveIntegerField(default=0) offensive_flag_count = models.SmallIntegerField(default=0) favourite_count = models.PositiveIntegerField(default=0) last_edited_at = models.DateTimeField(null=True, blank=True) last_edited_by = models.ForeignKey(User, null=True, blank=True, related_name='last_edited_questions') last_activity_at = models.DateTimeField(default=datetime.datetime.now) last_activity_by = models.ForeignKey(User, related_name='last_active_in_questions') tagnames = models.CharField(max_length=125) summary = models.CharField(max_length=180) html = models.TextField() comments = generic.GenericRelation(Comment) votes = generic.GenericRelation(Vote) flagged_items = generic.GenericRelation(FlaggedItem) email_feeds = generic.GenericRelation(EmailFeed) objects = QuestionManager() </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload