Skip to content

Instantly share code, notes, and snippets.

View karanmhatre1's full-sized avatar
πŸ‘½

Karan Mhatre karanmhatre1

πŸ‘½
View GitHub Profile
@karanmhatre1
karanmhatre1 / main.js
Last active May 24, 2023 02:17
Barba JS Hooks
transitions: [{
async leave(data) {
const done = this.async();
loadingAnimation();
await delay(1000);
done();
},
enter(data) { contentAnimation(); },
@karanmhatre1
karanmhatre1 / models.py
Created April 14, 2020 08:35
User Profile Model
class UserProfile(TimestampModel):
user = models.OneToOneField(User, on_delete=models.CASCADE)
picture = models.TextField(null=True, blank=True)
@karanmhatre1
karanmhatre1 / views.py
Last active May 17, 2024 10:06
Django Social Auth Pipeline function for fetching Google profile picture
def update_user_social_data(strategy, *args, **kwargs):
response = kwargs['response']
backend = kwargs['backend']
user = kwargs['user']
if response['picture']:
url = response['picture']
userProfile_obj = UserProfile()
userProfile_obj.user = user
userProfile_obj.picture = url