django-stdimage traceback “The ‘%s’ attribute has no file associated with it”

This traceback happening when you check file to __delete__, but file do not exist on file system

My traceback:

Traceback (most recent call last):

 File "/var/www/engine/django/core/handlers/", line 100, in get_response
   response = callback(request, *callback_args, **callback_kwargs)

 File "/var/www/engine/lib/", line 33, in wrapper
   output = func(request, *args, **kw)

 File "/var/www/engine/participants/", line 44, in participants_regform
   if form.is_valid():

 File "/var/www/engine/django/forms/", line 121, in is_valid
   return self.is_bound and not bool(self.errors)

 File "/var/www/engine/django/forms/", line 112, in _get_errors

 File "/var/www/engine/django/forms/", line 269, in full_clean

 File "/var/www/engine/django/forms/", line 320, in _post_clean
   self.instance = construct_instance(self, self.instance, opts.fields, opts.exclude)

 File "/var/www/engine/django/forms/", line 54, in construct_instance
   f.save_form_data(instance, cleaned_data[])

 File "/var/www/engine/stdimage/", line 130, in save_form_data
   filename = getattr(instance,

 File "/var/www/engine/django/db/models/fields/", line 64, in _get_path

 File "/var/www/engine/django/db/models/fields/", line 47, in _require_file
   raise ValueError("The '%s' attribute has no file associated with it." %

ValueError: The 'photo' attribute has no file associated with it.

Change formfield method of class StdImageField in

diff --git a/engine/stdimage/ b/engine/stdimage/
index f1d2125..894bbb2 100644
--- a/engine/stdimage/
+++ b/engine/stdimage/
@@ -1,4 +1,5 @@
+from django.contrib.admin.widgets import AdminFileWidget
@@ -117,8 +118,10 @@ class StdImageField(ImageField):
         Specify form field and widget to be used on the forms
-        kwargs['widget'] = DelAdminFileWidget
-        kwargs['form_class'] = StdImageFormField
+        #kwargs['widget'] = DelAdminFileWidget
+        if kwargs.get('widget') == AdminFileWidget:
+            kwargs['widget'] = DelAdminFileWidget
+            kwargs['form_class'] = StdImageFormField
         return super(StdImageField, self).formfield(**kwargs)


coded by nessus