def save(self): _image = self.cleaned_data.get('image') _nickname = self.cleaned_data.get('nickname') _bio = self.cleaned_data.get('bio') _gender = self.cleaned_data.get('gender') _location = self.cleaned_data.get('location') # print _nickname if _image: avatar_file = HandleImage(_image) self.user_cache.profile.avatar = avatar_file.avatar_save() if _nickname: self.user_cache.profile.nickname = _nickname if _gender: self.user_cache.profile.gender = _gender if _location: self.user_cache.profile.location = _location # if _email: # self.user_cache.email = _email # self.user_cache.save() # # if _password: # self.user_cache.set_password(_password) # self.user_cache.save() if _bio: self.user_cache.profile.bio = _bio self.user_cache.profile.save() return self.user_cache.v3_toDict()
def save(self): # self.user = user _avatar_file = self.cleaned_data.get('avatar_file') # log.info(_avatar_file) _image = HandleImage(image_file= _avatar_file) avatar_path_name = _image.avatar_save() self.user.profile.avatar = avatar_path_name self.user.profile.save()
def save(self): self.api_key = self.cleaned_data.get('api_key') self.user_cache = super(MobileUserSignUpForm, self).save() _avatar_file = self.cleaned_data.get('image') if _avatar_file: _image = HandleImage(image_file=_avatar_file) avatar_path_name = _image.avatar_save() self.user_cache.profile.avatar = avatar_path_name self.user_cache.profile.save() return self.user_cache
def fetch_avatar(avatar_url, user_id, *args, **kwargs): try: profile = User_Profile.objects.get(user_id = user_id) except User_Profile.DoesNotExist: return f = urllib2.urlopen(avatar_url) # return image = HandleImage(f) avatar_file = image.avatar_save(resize=False) profile.avatar = avatar_file profile.save()
def save(self, user): _avatar_file = self.cleaned_data.get('avatar') _bio = self.cleaned_data.get('bio') _bio = clean_user_text(_bio) _gender = self.cleaned_data.get('gender') _location = self.cleaned_data.get('location') _city = self.cleaned_data.get('city') self.user = user if _avatar_file: _image = HandleImage(image_file=_avatar_file) _image.crop_square() avatar = _image.avatar_save(resize=True) self.user.profile.avatar = avatar self.user.profile.bio = _bio self.user.profile.gender = _gender self.user.profile.location = _location self.user.profile.city = _city self.user.profile.save()
def save(self): self.api_key = self.cleaned_data.get('api_key') _nickname = self.cleaned_data.get('nickname') _email = self.cleaned_data.get('email') _password = self.cleaned_data.get('password') _taobao_id = self.cleaned_data.get('taobao_id') _taobao_token = self.cleaned_data.get('taobao_token') _screen_name = self.cleaned_data.get('screen_name') # _api_key = self.cleaned_data.get('api_key') self.user_cache = GKUser.objects.create_user( email=_email, password=_password, is_active=GKUser.active, ) User_Profile.objects.create( user=self.user_cache, nickname=_nickname, ) _avatar_file = self.cleaned_data.get('image') if _avatar_file: _image = HandleImage(image_file=_avatar_file) avatar_path_name = _image.avatar_save() self.user_cache.profile.avatar = avatar_path_name self.user_cache.profile.save() update_token.delay(user_id=self.user_cache.id, taobao_id=_taobao_id, screen_name=_screen_name, access_token=_taobao_token, expires_in=7200) return self.user_cache
def save(self): _image = self.cleaned_data.get('image') _nickname = self.cleaned_data.get('nickname') _email = self.cleaned_data.get('email') _password = self.cleaned_data.get('password') # print _nickname if _image: avatar_file = HandleImage(_image) self.user_cache.profile.avatar = avatar_file.avatar_save() if _nickname: self.user_cache.profile.nickname = _nickname if _email: self.user_cache.email = _email self.user_cache.save() if _password: self.user_cache.set_password(_password) self.user_cache.save() self.user_cache.profile.save() return self.user_cache.v3_toDict()