Hello all,

I'm trying to add the user when upload a file using the admin in Django.
The model is:
class Image(models.Model):
    image = models.FileField(upload_to=DIR_IMAGES, max_length=500)
created_by = models.ForeignKey(User, related_name='created_by', editable=False)

in admin.py, i have:
class ImageAdmin(admin.ModelAdmin):
    def myfunc(self, obj):
        return obj.created_by

    fieldsets = [
        (None, {'fields': ['image']}),
        ('', {'fields': ['myfunc', ]})
    ]

and i fails with message:
http://localhost:8003/admin/catalogue/image/add/
FieldError at /admin/catalogue/image/add/
Unknown field(s) myfunc specified for Image. Check fields/fieldsets/exclude attributes of class ImageAdmin.

where am i wrong?

Thanks in advance for help

--
Gérard Henry

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/56CF5E3A.1030809%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to