def updated_profile(self, user): user.username = self.username.data user.email = self.email.data if self.password.data: user.password = self.password.data if user.company_detail: company = user.company_detail else: company = Company() company.user_id = user.id if self.slug.data: company.slug = self.slug.data if self.location.data: company.location = self.location.data if self.site.data: company.site = self.site.data if self.logo.data: company.logo = self.logo.data if self.description.data: company.description = self.description.data if self.about.data: company.about = self.about.data db.session.add(user) db.session.add(company) db.session.commit()
def create_companyProfile(self): user = User() company = Company() company.location = self.location.data company.number_of_people = dict(PEOPLE_CHOICES).get( self.number_of_people.data) company.company_name = self.companyName.data company.save() user.company_id = company.id user.username = self.username.data user.email = self.email.data user.password = self.password.data user.save()