Hi, i have errors while i am trying to upload image by an admin panel.

Here is my image model:

class Photo(models.Model):
    Title = models.CharField(max_length=256)
    Description = models.TextField(max_length=1024, blank=True)
    User = models.ForeignKey(User)
    File = models.ImageField(upload_to='photos/%Y/%m/%d',
height_field=60, width_field=468)
    def __unicode__(self):
        return self.User + " (%s)" % self.Title

and error:

TypeError at /admin/main/photo/add/
attribute name must be stringRequest Method:    POST
Request URL:    http://localhost:8000/admin/main/photo/add/
Exception Type: TypeError
Exception Value:        attribute name must be string
Exception Location:     /usr/lib/python2.4/site-packages/django/db/models/
fields/files.py in save, line 213
Python Executable:      /usr/bin/python
Python Version: 2.4.4

traceback:

Traceback:
File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py"
in get_response
  86.                 response = callback(request, *callback_args,
**callback_kwargs)
File "/usr/lib/python2.4/site-packages/django/contrib/admin/sites.py"
in root
  157.                 return self.model_page(request, *url.split('/',
2))
File "/usr/lib/python2.4/site-packages/django/views/decorators/
cache.py" in _wrapped_view_func
  44.         response = view_func(request, *args, **kwargs)
File "/usr/lib/python2.4/site-packages/django/contrib/admin/sites.py"
in model_page
  176.         return admin_obj(request, rest_of_url)
File "/usr/lib/python2.4/site-packages/django/contrib/admin/
options.py" in __call__
  191.             return self.add_view(request)
File "/usr/lib/python2.4/site-packages/django/db/transaction.py" in
_commit_on_success
  238.                 res = func(*args, **kw)
File "/usr/lib/python2.4/site-packages/django/contrib/admin/
options.py" in add_view
  484.                 new_object = self.save_form(request, form,
change=False)
File "/usr/lib/python2.4/site-packages/django/contrib/admin/
options.py" in save_form
  370.         return form.save(commit=False)
File "/usr/lib/python2.4/site-packages/django/forms/models.py" in save
  319.         return save_instance(self, self.instance,
self._meta.fields, fail_message, commit)
File "/usr/lib/python2.4/site-packages/django/forms/models.py" in
save_instance
  61.         f.save_form_data(instance, cleaned_data[f.name])
File "/usr/lib/python2.4/site-packages/django/db/models/fields/
files.py" in save_form_data
  192.             getattr(instance, self.name).save(data.name, data,
save=False)
File "/usr/lib/python2.4/site-packages/django/db/models/fields/
files.py" in save
  213.             setattr(self.instance, self.field.width_field,
self.width)

Exception Type: TypeError at /admin/main/photo/add/
Exception Value: attribute name must be string

please help, i don't have any clue what might be a problem. Thank you.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to