Looks like the trick is to use the correct variable.

ct_fk_name is bad.
ct_fk_field is good.

:)


On Mar 5, 7:13 am, "[email protected]" <[email protected]> wrote:
> I've been able to successfully setup the tagging.models.TaggedItem as
> aGenericTabularInlinefor my django admin interface.
>
> When I try to do the same for contrib.comments, it always seems to
> look for 'object_id'.  Looks like the comment model was change in the
> past year.
>
> Has anyone successfully added contrib.comments inline on the admin
> app?
>
> cheers,
>
> -Brian
>
> P.S.:
>
> Here's my inline class:
>
> class CommentInline(generic.GenericTabularInline):
>     model = comments.models.Comment
>     ct_field = 'content_type'
>     ct_fk_name = 'object_pk'
>     verbose_name = "Comment"
>     verbose_name_plural = "Comments"
>
> Here's the traceback:
>
> Environment:
>
> Request Method: GET
>
> Django Version: 1.0.2 final
> Python Version: 2.5.4
> Installed Applications:
> ['django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.sites',
>  'django.contrib.admin',
>  'django.contrib.comments',
>  'django_evolution',
>  'tagging',
>  'yeti.fldm']
> Installed Middleware:
> ('django.middleware.common.CommonMiddleware',
>  'django.contrib.sessions.middleware.SessionMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware')
>
> Traceback:
> File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/
> django/core/handlers/base.py" in get_response
>   86.                 response = callback(request, *callback_args,
> **callback_kwargs)
> File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/
> django/contrib/admin/sites.py" in root
>   157.                 return self.model_page(request, *url.split('/',
> 2))
> File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/
> django/views/decorators/cache.py" in _wrapped_view_func
>   44.         response = view_func(request, *args, **kwargs)
> File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/
> django/contrib/admin/sites.py" in model_page
>   176.         return admin_obj(request, rest_of_url)
> File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/
> django/contrib/admin/options.py" in __call__
>   197.             return self.change_view(request, unquote(url))
> File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/
> django/db/transaction.py" in _commit_on_success
>   238.                 res = func(*args, **kw)
> File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/
> django/contrib/admin/options.py" in change_view
>   591.             for FormSet in self.get_formsets(request, obj):
> File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/
> django/contrib/admin/options.py" in get_formsets
>   281.             yield inline.get_formset(request, obj)
> File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/
> django/contrib/contenttypes/generic.py" in get_formset
>   381.         return generic_inlineformset_factory(self.model,
> **defaults)
> File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/
> django/contrib/contenttypes/generic.py" in
> generic_inlineformset_factory
>   346.     fk_field = opts.get_field(fk_field) # let the exception
> propagate
> File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/
> django/db/models/options.py" in get_field
>   263.         raise FieldDoesNotExist, '%s has no field named %r' %
> (self.object_name, name)
>
> Exception Type: FieldDoesNotExist at /admin/fldm/ptr/22326/
> Exception Value: Comment has no field named 'object_id'
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to