def createNewProfile(firstName,lastName,username,email,password,phoneNumber, \ address,sharezone,city,state,status,preferences_privacy): newProfile = Profile(user = User.objects.create_user(username,email,password), \ phoneNumber = phoneNumber, streetAddress = address, sharezone = sharezone, \ city = city, state = state, \ status = status, preferences_Privacy = preferences_privacy) newProfile.user.first_name = firstName newProfile.user.last_name = lastName newProfile.user.save() newProfile.save() return newProfile
def newProfile(userObject, phonenumber, address): profileObject = Profile(user=userObject) profileObject = timezone.now() profileObject.phoneNumber = phonenumber """start of possibly bad code - may need fixing depending on how frontend handles address and sends here (as of now assumes the address is a string) """ profileObject.address = address profileObject.shareZone = address[-5:] #slice end off of address string """end of possibly bad code """ profileObject.reputation = 50 #set reputation to 50 (default value) """default preference object should be assigned """ profileObject.preferences = '' """end of possibly bad code """ return profileObject
"*****@*****.**", "*****@*****.**", "*****@*****.**"] phoneNumbers = ["1234567890", "2032097215", "9176905094", "2404697313", "2482292139", \ "3154805597", "6176803278"] profileObjects = [] for x in range(len(names)): firstName = names[x][0] lastName = names[x][1] userName = firstName + lastName email = emails[x] pn = phoneNumbers[x] x = str(x) newProfile = Profile(user = User.objects.create_user(userName, email, 'password'), \ phoneNumber = pn, streetAddress = '1 Lomb Memorial Drive', sharezone = '14623', \ city = 'Rochester', state = 'NY', stateName = 'New York', \ status = 'status') newProfile.user.first_name = firstName newProfile.user.last_name = lastName newProfile.user.save() if userName == "AlArujunan": newProfile.emailNotifs == False newProfile.textNotifs == False newProfile.save() profileObjects.append(newProfile) shedNames = ["AlArujunan's Shed", "JakeDulin's Shed", "RoyCohen's Shed", "AlexBowen's Shed", "TaikhoomAttar's Shed", \ "JacksonMcMahon's Shed", "AdamWalsh's Shed"] shedObjects = []
"*****@*****.**", "*****@*****.**", "*****@*****.**"] phoneNumbers = ["1234567890", "2032097215", "9176905094", "2404697313", "2482292139", \ "3154805597", "6176803278"] profileObjects = [] for x in range(len(names)): firstName = names[x][0] lastName = names[x][1] userName = firstName+lastName email = emails[x] pn = phoneNumbers[x] x = str(x) newProfile = Profile(user = User.objects.create_user(userName, email, 'password'), \ phoneNumber = pn, streetAddress = '1 Lomb Memorial Drive', sharezone = '14623', \ city = 'Rochester', state = 'NY', stateName = 'New York', \ status = 'status') newProfile.user.first_name = firstName newProfile.user.last_name = lastName newProfile.user.save() if userName == "AlArujunan": newProfile.emailNotifs == False newProfile.textNotifs == False newProfile.save() profileObjects.append(newProfile) shedNames = ["AlArujunan's Shed", "JakeDulin's Shed", "RoyCohen's Shed", "AlexBowen's Shed", "TaikhoomAttar's Shed", \ "JacksonMcMahon's Shed", "AdamWalsh's Shed"] shedObjects = []
def save(self,commit = True): user = super(UserRegistrationForm, self).save(commit = False) newProfile = Profile() newProfile.phoneNumber = self.cleaned_data['phone_number'] newProfile.streetAddress = self.cleaned_data['street_address'] newProfile.sharezone = self.cleaned_data['zip_code'] newProfile.city = self.cleaned_data['city'] newProfile.state = self.cleaned_data['state'] newProfile.stateName = STATE_DICT[self.cleaned_data['state']] newProfile.emailNotifs = self.cleaned_data['email_notifications'] newProfile.textNotifs = self.cleaned_data['text_notifications'] newProfile.picture = '' newProfile.status = '' newProfile.reputation = 50 newProfile.preferences = '' newProfile.timeCreated = timezone.now() if commit: user.save() newProfile.user = user newProfile.save() return user
def save(self, commit=True): user = super(UserRegistrationForm, self).save(commit=False) newProfile = Profile() newProfile.phoneNumber = self.cleaned_data['phone_number'] newProfile.streetAddress = self.cleaned_data['street_address'] newProfile.sharezone = self.cleaned_data['zip_code'] newProfile.city = self.cleaned_data['city'] newProfile.state = self.cleaned_data['state'] newProfile.stateName = STATE_DICT[self.cleaned_data['state']] newProfile.emailNotifs = self.cleaned_data['email_notifications'] newProfile.textNotifs = self.cleaned_data['text_notifications'] newProfile.picture = '' newProfile.status = '' newProfile.reputation = 50 newProfile.preferences = '' newProfile.timeCreated = timezone.now() if commit: user.save() newProfile.user = user newProfile.save() return user