When using a ForeignKey with the related_name argument in an abstract base class, the reverse accessors for child models aren't created.
The problem can be reproduced using the following models:
import datetime
from django.db import models
class Post(models.Model):
title = models.CharField(u'Title', max_length=50)
class Attachment(models.Model):
post = models.ForeignKey(Post, related_name='attached_%(class)s_set')
content = models.TextField(u'Content')
class Meta:
abstract = True
class Comment(Attachment):
is_spam = models.BooleanField(u'Spam')
class Update(Attachment):
timestamp = models.DateTimeField(default=datetime.datetime.now)
Given those models, I would expect Post to have two accessors for related models: Post.attached_comment_set and Post.attached_update_set, but it doesn't. In their place is a single accessor named Post.attached_%(class)s_set.
I'm attaching a patch that rearranges django.db.models.fields.related.RelatedField.contribute_to_class enough to get the accessor methods, but I didn't see where the attached_%(class)s_set attribute was being created.