I am working and using dj-rest-auth and Django-allauth on a project where the user has a profile photo field in his user model. This field has a one to one relationship with another model that has a file field. It is a file field because the user should be able to add images and gifs as his profile photo.
The problem is that when the user signs up using google the profile photo is gotten from google, which is a URL. How can I go around this?
my photo model
class Photo(models.Model):
'''
This model will be a general model for files upload to amazon
'''
url = models.FileField()
def __str__(self):
return self.url
class User(AbstractBaseUser, PermissionsMixin):
email = models.EmailField(max_length=254, unique=True)
name = models.CharField(max_length=250)
display_picture = models.OneToOneField(Photo, on_delete=models.CASCADE, related_name='dp', blank=True)
is_staff = models.BooleanField(default=False)
is_superuser = models.BooleanField(default=False)
is_active = models.BooleanField(default=True)
last_login = models.DateTimeField(null=True, blank=True)
date_joined = models.DateTimeField(auto_now_add=True)
slug = models.SlugField(max_length=255, unique=True, blank=True)
add two more fields to your Photo model: