コード例 #1
0
def process_property_data_before_posting(property_data, request_data, email):
	
	"""
		Add necessary fields to property dictionary
		before indexing property data, 
		store image in full size & thumbnails format. 

	"""

	custom_id = "PROP-"  + cstr(int(time.time())) + '-' +  cstr(random.randint(10000,99999))
	property_data["property_id"] = custom_id
	meta_dict = add_meta_fields_before_posting(request_data)
	property_data.update(meta_dict)
	property_photo_url_dict = store_property_photos_in_propshikari(request_data.get("property_photos"),custom_id)
	property_data["full_size_images"] = property_photo_url_dict.get("full_size",[])
	property_data["thumbnails"] = property_photo_url_dict.get("thumbnails",[])
	property_data["property_photo"] = property_photo_url_dict.get("thumbnails")[0] if len(property_photo_url_dict.get("thumbnails")) else ""
	property_data["posted_by"] = request_data.get("user_id")
	property_data["user_email"] = email
	property_data["posting_date"] = property_data.get("posting_date") if property_data.get("posting_date") else property_data.get("creation_date")
	property_data["amenities"] = putil.prepare_amenities_data(property_data.get("amenities",""), property_data.get("property_type"))
	property_data["flat_facilities"] = putil.prepare_flat_facilities_data(property_data.get("flat_facilities",""), property_data.get("property_type"))
	property_data["possession_status"] = "Immediate" if property_data.get("possession") else property_data.get("possession_date")
	property_data["discounted_price"] = putil.get_discounted_price(property_data) if property_data.get("discount_percentage") else 0.0
	mandatory_list = property_mandatory_fields.get(property_data.get("property_type"))
	property_data["percent_completion"] = putil.calculate_percent_completion(property_data, mandatory_list)
	if not property_data.get("possession_date"):
		property_data.pop("possession_date", None)
	return custom_id	
コード例 #2
0
def prepare_property_posting_data(project_data):
    property_data = []
    new_project_data = get_property_specific_keys(project_data)

    for prop in project_data.get("property_details"):
        prop_dict = {}
        prop_list = []
        prop_dict["property_title"] = project_data.get("project_name")
        prop_dict["property_type"] = prop.get("property_type")
        prop_dict["property_subtype"] = prop.get("property_subtype")
        prop_dict["property_subtype_option"] = prop.get(
            "property_subtype_option", "")
        prop_dict["operation"] = project_data.get("operation")
        prop_dict["carpet_area"] = prop.get("max_area")
        prop_dict["price"] = prop.get("max_price")
        prop_dict["unit_of_area"] = prop.get("unit_of_area")
        prop_dict["published_status"] = "Unpublished"
        prop_dict["property_photo"] = project_data.get("project_photo", "")
        prop_dict["flat_facilities"] = putil.prepare_flat_facilities_data(
            [], prop.get("property_type"))
        prop_dict.update(new_project_data)
        mandatory_list = property_mandatory_fields.get(
            prop.get("property_type"))
        prop_dict["status"] = "Deactivated"
        prop_dict["tag"] = []
        prop_dict["percent_completion"] = putil.calculate_percent_completion(
            prop_dict, mandatory_list)
        prop_list = [prop_dict] * cint(prop.get("count"))
        property_data.extend(prop_list)
    return property_data
コード例 #3
0
def prepare_property_posting_data(project_data):
	property_data = []
	new_project_data = get_property_specific_keys(project_data)

	for prop in project_data.get("property_details"):
		prop_dict = {}
		prop_list = []
		prop_dict["property_title"] =  project_data.get("project_name")
		prop_dict["property_type"] = prop.get("property_type")
		prop_dict["property_subtype"] = prop.get("property_subtype")
		prop_dict["property_subtype_option"] = prop.get("property_subtype_option", "")
		prop_dict["operation"] = project_data.get("operation")
		prop_dict["carpet_area"] = prop.get("max_area")
		prop_dict["price"] = prop.get("max_price")
		prop_dict["unit_of_area"] = prop.get("unit_of_area")
		prop_dict["published_status"] = "Unpublished"
		prop_dict["property_photo"] = project_data.get("project_photo","")
		prop_dict["flat_facilities"] = putil.prepare_flat_facilities_data([], prop.get("property_type"))
		prop_dict.update(new_project_data)
		mandatory_list = property_mandatory_fields.get(prop.get("property_type"))
		prop_dict["status"] = "Deactivated"
		prop_dict["tag"] = []
		prop_dict["percent_completion"] = putil.calculate_percent_completion(prop_dict, mandatory_list)
		prop_list = [prop_dict] * cint(prop.get("count"))
		property_data.extend(prop_list)
	return property_data	
コード例 #4
0
def init_for_project_photo_upload(request_data, project_data):
    property_photo_url_dict = store_property_photos_in_propshikari(
        request_data.get("project_photos"), project_data.get("project_id"))
    project_data["full_size_images"] = property_photo_url_dict.get(
        "full_size", [])
    project_data["thumbnails"] = property_photo_url_dict.get("thumbnails", [])
    project_data["project_photo"] = property_photo_url_dict.get(
        "thumbnails")[0] if len(
            property_photo_url_dict.get("thumbnails")) else ""
    project_data["percent_completion"] = putil.calculate_percent_completion(
        project_data, project_mandatory_fields)
コード例 #5
0
def process_property_data_before_posting(property_data, request_data, email):
	
	"""
		Add necessary fields to property dictionary
		before indexing property data, 
		store image in full size & thumbnails format. 

	"""
	custom_id = "PROP-"  + cstr(int(time.time())) + '-' +  cstr(random.randint(10000,99999))
	property_data["property_id"] = custom_id
	meta_dict = add_meta_fields_before_posting(request_data)
	property_data.update(meta_dict)
	property_photo_url_dict = store_property_photos_in_propshikari(request_data.get("property_photos"),custom_id)
	property_data["full_size_images"] = property_photo_url_dict.get("full_size",[])
	property_data["thumbnails"] = property_photo_url_dict.get("thumbnails",[])
	property_data["property_photo"] = property_photo_url_dict.get("thumbnails")[0] if len(property_photo_url_dict.get("thumbnails")) else ""
	property_data["posted_by"] = request_data.get("user_id")
	property_data["user_email"] = email
	property_data["posting_date"] = property_data.get("posting_date") if property_data.get("posting_date") else property_data.get("creation_date")
	property_data["amenities"] = putil.prepare_amenities_data(property_data.get("amenities",""), property_data.get("property_type"))
	property_data["flat_facilities"] = putil.prepare_flat_facilities_data(property_data.get("flat_facilities",""), property_data.get("property_type"))
	property_data["possession_status"] = "Immediate" if property_data.get("possession") else property_data.get("possession_date")
	property_data["discounted_price"] = putil.get_discounted_price(property_data) if property_data.get("discount_percentage") else 0.0
	mandatory_list = property_mandatory_fields.get(property_data.get("property_type"))
	property_data["percent_completion"] = putil.calculate_percent_completion(property_data, mandatory_list)
	# added by arpit for  published_status
	if request_data.get("request_source") == "bulk_upload":
		property_data["published_status"] = "published"
		property_data["status"] = "Active"
	else:
		property_data["published_status"] = "Unpublished"
		property_data["status"] = "Deactivated"
			
	property_data["tag"] = property_data.get("tag") if property_data.get("tag") else []
	# end of code
	if not property_data.get("possession_date"):
		property_data.pop("possession_date", None)
	return custom_id	
コード例 #6
0
def init_for_project_photo_upload(request_data, project_data):
	property_photo_url_dict = store_property_photos_in_propshikari(request_data.get("project_photos"), project_data.get("project_id"))
	project_data["full_size_images"] = property_photo_url_dict.get("full_size",[])
	project_data["thumbnails"] = property_photo_url_dict.get("thumbnails",[])
	project_data["project_photo"] = property_photo_url_dict.get("thumbnails")[0] if len(property_photo_url_dict.get("thumbnails")) else ""
	project_data["percent_completion"] = putil.calculate_percent_completion(project_data, project_mandatory_fields)