def save_instance_form(self, form, user): company = Company() company.nit = form.cleaned_data['nit'] company.name = form.cleaned_data['name'] company.location = form.cleaned_data['location'] company.website = form.cleaned_data['website'] company.email = form.cleaned_data['email'] company.phone = form.cleaned_data['phone'] company.save() user.company = company user.save()
def load_company(session, company_data): company = Company( name=company_data.get('name'), website=company_data.get('website'), description=company_data.get('description'), size=company_data.get('size'), remote=company_data.get('allows_remote') ) company.techs = [Tech(name=tech_name) for tech_name in company_data.get('stack', [])] company.location = Location( city=company_data['location'].get('city'), country=company_data['location'].get('country'), postcode=company_data['location'].get('postcode') ) session.add(company) session.commit()