KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have the following model set up: class UserProfile(models.Model): "Additional attributes for users." url = models.URLField() location = models.CharField(max_length=100) user = models.ForeignKey(User, unique=True) avatar = models.ImageField(upload_to='/home/something/www/avatars', height_field=80, width_field=80) def __unicode__(self): return "Profile of " + self.user.username It's supposed to store additional information about a user, for example an avatar . Unfortunately, when I try to upload an image via the admin panel, it gives me an error, something like: getattr(): attribute name must be string Which is not produced when I remove that field from the model, do a db reset and reload the server. I'd imagine the cause is this particular field, just not sure how. This is my traceback: File "/usr/lib/pymodules/python2.6/django/core/handlers/base.py" in get_response 92. response = callback(request, *callback_args, **callback_kwargs) File "/usr/lib/pymodules/python2.6/django/contrib/admin/options.py" in wrapper 226. return self.admin_site.admin_view(view)(*args, **kwargs) File "/usr/lib/pymodules/python2.6/django/views/decorators/cache.py" in _wrapped_view_func 44. response = view_func(request, *args, **kwargs) File "/usr/lib/pymodules/python2.6/django/contrib/admin/sites.py" in inner 186. return view(request, *args, **kwargs) File "/usr/lib/pymodules/python2.6/django/db/transaction.py" in _commit_on_success 240. res = func(*args, **kw) File "/usr/lib/pymodules/python2.6/django/contrib/admin/options.py" in add_view 718. new_object = self.save_form(request, form, change=False) File "/usr/lib/pymodules/python2.6/django/contrib/admin/options.py" in save_form 551. return form.save(commit=False) File "/usr/lib/pymodul
Tags (comma-separated)
Save Edits
Cancel