こんにちは(私の醜い英語ですみません:p)、
次の 2 つの単純なモデルを想像してください。
from django.contrib.contenttypes import generic
from django.db import models
class SomeModel(models.Model):
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField(_('object id'))
content_object = generic.GenericForeignKey('content_type', 'object_id')
published_at = models.DateTimeField('Publication date')
class SomeOtherModel(models.Model):
related = generic.GenericRelation(SomeModel)
私は SomeOtherModel で archive_index 汎用ビューを使用したいのですが、うまくいきません:
from django.views.generic.date_based import archive_index
archive_index(request, SometherModel.objects.all(), 'related__published_at')
エラーは、28行目のarchive_indexから発生します(django 1.1を使用):
date_list = queryset.dates(date_field, 'year')[::-1]
発生した例外は次のとおりです。
SomeOtherModel has no field named 'related__published_at'
それを修正する考えはありますか?
どうもありがとうございました :)