コード例 #1
0
ファイル: walmart.py プロジェクト: ryanwellman/trashboard
def Location(address, city, state, zipcode, country):
    cust_address = Address()
    cust_address.address = address
    cust_address.city = city
    cust_address.state = state
    cust_address.zip = zipcode
    cust_address.county = country
    cust_address.save()

    return cust_address.id
コード例 #2
0
    def update_from_blob(self, update_blob):
        # this is where the vast majority of the magic is going to happen.
        if 'applicant' in update_blob:
            self.update_applicant(which='applicant', app_blob=update_blob['applicant'])

        if 'coapplicant' in update_blob:
            self.update_applicant(which='coapplicant', app_blob=update_blob['coapplicant'])

        if self.agreement.applicant_id == self.agreement.coapplicant_id:
            # If coapplicant is the applicant, remove it.
            self.agreement.coapplicant = None

        if 'system_address' in update_blob:
            target_address = self.agreement.system_address
            if not target_address:
                target_address = Address()

            target_address.update_from_blob(update_blob['system_address'], self)
            target_address.save()
            self.agreement.system_address = target_address

        self.update_credit_status(update_blob)


        for field in ['floorplan', 'property_type', 'install_method', 'email']:
            print update_blob[field]
            if field in update_blob:
                setattr(self.agreement, field, update_blob[field])

        self.available_install_methods = self.agreement.available_install_methods()
        print "install stuff", self.available_install_methods

        if self.agreement.install_method and self.agreement.install_method not in self.available_install_methods:
            self.agreement.install_method = None
            self.messages.append('The installation method chosen is no longer available.')

        self.apply_restrictions()

        self.agreement.save()

        if 'invoice_lines' in update_blob:
            self.update_invoice_lines()
コード例 #3
0
    def update_from_blob(self, update_blob):
        # this is where the vast majority of the magic is going to happen.
        if 'applicant' in update_blob:
            self.update_applicant(which='applicant',
                                  app_blob=update_blob['applicant'])

        if 'coapplicant' in update_blob:
            self.update_applicant(which='coapplicant',
                                  app_blob=update_blob['coapplicant'])

        if self.agreement.applicant_id == self.agreement.coapplicant_id:
            # If coapplicant is the applicant, remove it.
            self.agreement.coapplicant = None

        if 'system_address' in update_blob:
            target_address = self.agreement.system_address
            if not target_address:
                target_address = Address()

            target_address.update_from_blob(update_blob['system_address'],
                                            self)
            target_address.save()
            self.agreement.system_address = target_address

        self.update_credit_status(update_blob)

        for field in ['floorplan', 'property_type', 'install_method', 'email']:
            print update_blob[field]
            if field in update_blob:
                setattr(self.agreement, field, update_blob[field])

        self.available_install_methods = self.agreement.available_install_methods(
        )
        print "install stuff", self.available_install_methods

        if self.agreement.install_method and self.agreement.install_method not in self.available_install_methods:
            self.agreement.install_method = None
            self.messages.append(
                'The installation method chosen is no longer available.')

        self.apply_restrictions()

        self.agreement.save()

        if 'invoice_lines' in update_blob:
            self.update_invoice_lines()