Skip to content
This repository was archived by the owner on Aug 12, 2020. It is now read-only.

TemplateSyntaxError at /admin/fileupload/picture/ Caught TypeError while rendering: coercing to Unicode: need string or buffer, FieldFile found #22

Closed
ET-CS opened this issue Jan 19, 2013 · 3 comments

Comments

@ET-CS
Copy link
Collaborator

ET-CS commented Jan 19, 2013

django-jquery-file-upload works fine. the problem is in the admin panel using django 1.3.4 from EPEL on centos 6.3 minimal.

When I get inside the admin panel - into the 'picture' table when it's empty, - everything is fine. when there are rows - it return error 500. with DEBUG:

TemplateSyntaxError at /admin/fileupload/picture/
Caught TypeError while rendering: coercing to Unicode: need string or buffer, FieldFile found

the def unicode for the model is set to return self.file. which django dosen't accept.
when I am changing it to self.slug - everything works fine again in the admin panel but the jquery uploader stops working.

@ET-CS
Copy link
Collaborator Author

ET-CS commented Jan 19, 2013

in order to pictures to show on admin panel i've added a 'admin.py' file inside fileupload with:

from fileupload.models import Picture
from django.contrib import admin

admin.site.register(Picture)

@ET-CS
Copy link
Collaborator Author

ET-CS commented Jan 24, 2013

the prolbem is fixed in the model by changing to this:

def __unicode__(self):
    return self.file.name

@sigurdga
Copy link
Owner

Thank you @ET-CS. I added the .name just now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants