the pic:
pic = instaloader.Instaloader(sleep=False, dirname_pattern='media/donor', save_metadata=False, compress_json=False)
pic.download_profile(profile_name=username, profile_pic_only=True)
pic's class ===>>> <class 'instaloader.instaloader.Instaloader'>
And I'm struggling with converting instaloader class into Contributors <<ImageField()>> of django models.
class Contributor(models.Model):
name = models.CharField(max_length=255, default=' ')
username = models.CharField(max_length=255, unique=True)
type = models.ForeignKey(ContributorType, on_delete=models.CASCADE, null=True)
picture = models.ImageField(upload_to='images/donor', max_length=255)
cont_village = models.ForeignKey(Village, on_delete=models.CASCADE, null=True)
How can I do this?
I tried with this way:
Contributor.objects.create(
username=url,
picture=pic,
)
But recieved: AttributeError
Exception Value:
'Instaloader' object has no attribute '_committed'