Django, error when trying to add search fields in the admin interface -
i trying add search field in admin interface userprofile class.
this models.py:
class userprofile(models.model): user = models.foreignkey(user, default=none, null=true, related_name='profile') # don't judge me. had use null=true registered = models.booleanfield(default=false) activated = models.booleanfield(default=false) activation_key = models.charfield(max_length=128) receive_notifications = models.booleanfield(default=false) email = models.charfield(max_length=80, default='') def __unicode__(self): return self.email and admin.py:
from main.models import userprofile django.contrib import admin class userprofileadmin(admin.modeladmin): search_fields = ['email'] admin.site.register(userprofileadmin) when try run server error:
'mediadefiningclass' object not iterable @ line register userprofileadmin.
what doing wrong?
this
admin.site.register(userprofileadmin) should
admin.site.register(userprofile, userprofileadmin)
Comments
Post a Comment