def data_cleanup(self): opportunity_data = self.pop_categories(categories=False) opportunity_data.pop('documents') opportunity_data['department_id'] = self.department.data.id opportunity_data['contact_id'] = parse_contact(opportunity_data.pop('contact_email'), self.department.data) return opportunity_data
def data_cleanup(self): opportunity_data = self.pop_categories(categories=False) opportunity_data.pop('documents') opportunity_data['department_id'] = self.department.data.id opportunity_data['contact_id'] = parse_contact(opportunity_data.pop('contact_email'), self.department.data) opportunity_data['vendor_documents_needed'] = [int(i[0]) for i in opportunity_data['vendor_documents_needed']] return opportunity_data
def data_cleanup(self): '''Cleans up form data for processing and storage 1. Pops off categories 2. Pops off documents (they are handled separately) 3. Sets the foreign keys Opportunity model relationships :returns: An ``opportunity_data`` dictionary, which can be used to instantiate or modify an :py:class:`~purchasing.opportunities.model.Opportunity` instance ''' opportunity_data = self.pop_categories(categories=False) opportunity_data.pop('documents') opportunity_data['department_id'] = self.department.data.id opportunity_data['contact_id'] = parse_contact(opportunity_data.pop('contact_email'), self.department.data) opportunity_data['vendor_documents_needed'] = [int(i[0]) for i in opportunity_data['vendor_documents_needed']] return opportunity_data
def data_cleanup(self): '''Cleans up form data for processing and storage 1. Pops off categories 2. Pops off documents (they are handled separately) 3. Sets the foreign keys Opportunity model relationships Returns: An ``opportunity_data`` dictionary, which can be used to instantiate or modify an :py:class:`~purchasing.opportunities.model.Opportunity` instance ''' opportunity_data = self.pop_categories(categories=False) opportunity_data.pop('documents') opportunity_data['department_id'] = self.department.data.id opportunity_data['contact_id'] = parse_contact(opportunity_data.pop('contact_email'), self.department.data) opportunity_data['vendor_documents_needed'] = [int(i[0]) for i in opportunity_data['vendor_documents_needed']] return opportunity_data