diff --git a/users/forms.py b/users/forms.py
index 1195ed0..2fa24ed 100644
--- a/users/forms.py
+++ b/users/forms.py
@@ -12,8 +12,9 @@ class Validation(forms.ModelForm):
image = self.cleaned_data.get('image', False)
if image:
- if image._size > self.MAX_UPLOAD_SIZE:
- raise forms.ValidationError(_("The image is too large. It should have less than 2MB."))
+ if hasattr(image, '_size'):
+ if image._size > self.MAX_UPLOAD_SIZE:
+ raise forms.ValidationError(_("The image is too large. It should have less than 2MB."))
return image
diff --git a/users/models.py b/users/models.py
index 0f6587a..c540c64 100644
--- a/users/models.py
+++ b/users/models.py
@@ -10,8 +10,9 @@ from django.contrib.staticfiles.templatetags.staticfiles import static
def validate_img_extension(value):
valid_formats = ['image/jpeg','image/x-citrix-jpeg','image/png','image/x-citrix-png','image/x-png']
- if not value.file.content_type in valid_formats:
- raise ValidationError(_('File not supported.'))
+ if hasattr(value.file, 'content_type'):
+ if not value.file.content_type in valid_formats:
+ raise ValidationError(_('File not supported.'))
class User(AbstractBaseUser, PermissionsMixin):
diff --git a/users/templates/users/profile.html b/users/templates/users/profile.html
index 6dda048..1d39726 100644
--- a/users/templates/users/profile.html
+++ b/users/templates/users/profile.html
@@ -54,10 +54,12 @@
+
+