Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not provided image is not handled #3

Open
Roland-Szucs opened this issue Jan 12, 2024 · 0 comments
Open

Not provided image is not handled #3

Roland-Szucs opened this issue Jan 12, 2024 · 0 comments

Comments

@Roland-Szucs
Copy link

I would like to use the app to make profile photo upload easy. I have a default User model in Django (5.01) and there is a Profile model with one to one link to the user model. When a user registers, I create a Profile instance with th foreign key and leave the other blank. Here is the field definition:

from django_cropper_image.fields import ImageCropperField
class UserProfile(models.Model):
...
avatar = ImageCropperField(verbose_name="Profil fotó",
                               upload_to="photos/%Y/%m",
                               max_length=255,
                               blank=True,
                               null=True)
...

When I try to save my profile, where the avatar field is empty as all the others but the user, I got an exception:

AttributeError: 'NoneType' object has no attribute 'get'

The issue is within your fields.py file at row 184 in pre_save method, the following line:

self.b64data = self.cropperconstobj.get()

Obviously the self.cropperconstobj is None.

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

No branches or pull requests

1 participant