Problem when trying to display field name on admin panel

65 views
Skip to first unread message

Kubilay Yazoğlu

unread,
Dec 1, 2017, 2:01:15 PM12/1/17
to Django users
Hello.
It gives error when I click on my app name in admin panel because of the "ratings" field. Without it, it loads fine. 
Error: 

KeyError at /admin/photo/photo/

'manager'

Error during template rendering

In template C:\Users\Root\Desktop\PhotashBackend\sanal\lib\site-packages\django\contrib\admin\templates\admin\change_list.html, error at line 82

The mentioned line is this  {% result_list cl %}


My model:

class Photo(models.Model):
photo = models.IntegerField(primary_key=True, verbose_name='Photo id')
photoItself = ResizedImageField(upload_to='photopool/', default='blog/static/manzara.jpg', verbose_name='Photo')
...
...
...
...
ratings = GenericRelation(Rating, related_query_name='photos')


And this is my admin.py:

from django.contrib import admin
from .models import Photo

class PhotoAdmin(admin.ModelAdmin):
list_display = ['photo', 'contest', 'ownername', 'howmany_votes_gotten', 'ratings']
list_display_links = ['photo']
list_filter = ['contest']
search_fields = ['ownername']

class Meta:
model = Photo


admin.site.register(Photo, PhotoAdmin)

Reply all
Reply to author
Forward
0 new messages