#16316: Error with GenericRelation applied to a subclass
----------------------------+----------------------------------------------
 Reporter:  jordanreiter@…  |          Owner:  nobody
     Type:  Bug             |         Status:  new
Milestone:                  |      Component:  Database layer (models, ORM)
  Version:  1.3             |       Severity:  Normal
 Keywords:                  |   Triage Stage:  Unreviewed
Has patch:  0               |  Easy pickings:  0
    UI/UX:  0               |
----------------------------+----------------------------------------------
 I noticed this when using the django-threadedcomments app and trying to
 add a `GenericRelation` pointing to the `ThreadedComment` model. I would
 assume this holds true for any model that subclasses a model with generic
 foreign keys.

 {{{
 class Discussion(models.Model):
     title = models.CharField(max_length=100, help_text='Enter a
 descriptive title for this discussion.')
     content = models.TextField(null=True, blank=True)
     date = models.DateTimeField()
     comments = generic.GenericRelation(ThreadedComment)
 }}}

 And then


 {{{
 >>> Discussion.objects.filter(comments__isnull=False)
 Traceback (most recent call last):
   File "<console>", line 1, in <module>
   File "/path/to/django/db/models/query.py", line 69, in __repr__
     data = list(self[:REPR_OUTPUT_SIZE + 1])
   File "/path/to/django/db/models/query.py", line 84, in __len__
     self._result_cache.extend(self._iter)
   File "/path/to/django/db/models/query.py", line 273, in iterator
     for row in compiler.results_iter():
   File "/path/to/django/db/models/sql/compiler.py", line 680, in
 results_iter
     for rows in self.execute_sql(MULTI):
   File "/path/to/django/db/models/sql/compiler.py", line 735, in
 execute_sql
     cursor.execute(sql, params)
   File "/path/to/django/db/backends/mysql/base.py", line 86, in execute
     return self.cursor.execute(query, args)
   File "/srv/python-environments/academicexperts/lib/python2.7/site-
 packages/MySQLdb/cursors.py", line 174, in execute
     self.errorhandler(self, exc, value)
   File "/srv/python-environments/academicexperts/lib/python2.7/site-
 packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
     raise errorclass, errorvalue
 OperationalError: (1054, "Unknown column
 'threadedcomments_comment.object_id' in 'on clause'")
 >>>

 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/16316>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to