예제 #1
0
def get_car_models_and_ids(car_model_tags, site, brand):
    results = []
    for car_model_tag in car_model_tags:
        car_model_name = car_model_tag['name']
        car_model_id = car_model_tag['value']
        print(car_model_name)
        model, created = Model.objects.get_or_create(name=car_model_name,
                                                     brand=brand)
        site_model = SiteModel()
        site_model.site = site
        site_model.model = model
        site_model.identifier = car_model_id
        site_model.save()
        results.append(site_model)
    return results
예제 #2
0
def get_car_models_and_ids(car_model_tags, site, brand):
    results = []
    for car_model_tag in car_model_tags:
        car_model_name = ' '.join(car_model_tag.string.split())
        print(car_model_name)
        car_model_id = car_model_tag['data-val']
        model, created = Model.objects.get_or_create(name=car_model_name,
                                                     brand=brand)
        site_model = SiteModel()
        site_model.site = site
        site_model.model = model
        site_model.identifier = car_model_id
        site_model.save()
        results.append(site_model)
    return results
예제 #3
0
def get_car_models_and_ids(car_model_tags, site, brand):
    results = []
    for car_model_tag in car_model_tags:
        car_model_name = ' '.join(car_model_tag.string.split())
	print(car_model_name)
        car_model_id = car_model_tag['data-val']
	model, created = Model.objects.get_or_create(name=car_model_name, brand=brand)
        site_model = SiteModel()
	site_model.site = site
	site_model.model = model
	site_model.identifier = car_model_id
	site_model.save()
        results.append(site_model)
    return results
예제 #4
0
def get_car_models_and_ids(car_model_tags, site, brand):
    results = []
    for car_model_tag in car_model_tags:
        car_model_name = car_model_tag['name']
        car_model_id = car_model_tag['value']
	print(car_model_name)
	model, created = Model.objects.get_or_create(name=car_model_name, brand=brand)
        site_model = SiteModel()
	site_model.site = site
	site_model.model = model
	site_model.identifier = car_model_id
	site_model.save()
        results.append(site_model)
    return results
예제 #5
0
def get_car_models_and_ids(car_model_tags, site, brand):
    results = []
    for car_model_tag in car_model_tags:
        search = re.search('^(.+) \(\d*\)', car_model_tag.text.encode('utf-8'))
        if search is None:
            continue
        car_model_string = search.group(1)
        car_model_name = ' '.join(car_model_string.split())
        car_model_id = car_model_tag['value']
        model, created = Model.objects.get_or_create(name=car_model_name,
                                                     brand=brand)
        site_model = SiteModel()
        site_model.site = site
        site_model.model = model
        site_model.identifier = car_model_id
        site_model.save()
        results.append(site_model)
    return results
예제 #6
0
def get_car_models_and_ids(car_model_tags, site, brand):
    results = []
    for car_model_tag in car_model_tags:
        search = re.search('^(.+) \(\d*\)', car_model_tag.text.encode('utf-8'))
        if search is None:
            continue
        car_model_string = search.group(1)
        car_model_name = ' '.join(car_model_string.split())
        car_model_id = car_model_tag['value']
	model, created = Model.objects.get_or_create(name=car_model_name, brand=brand)
        site_model = SiteModel()
	site_model.site = site
	site_model.model = model
	site_model.identifier = car_model_id
	site_model.save()
        results.append(site_model)
    return results