def create_user(self, company_id=-1): user = User() user.username = self.username.data user.email = self.email.data user.password = self.password.data if company_id != -1: user.company_id = company_id user.role = user.ROLE_COMPANY db.session.add(user) db.session.commit() return user
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()