-
-
Save woodbridge/4398576 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Homes.reset(["{\"list_price\": 129900, \"number_of_bedrooms\": 3, \"formatted_list_price\": \"129,900\", \"address\": \"1201 27th St Northeast\", \"property_type\": \"Residential\", \"city\": \"Canton\", \"mls_number\": 1547472, \"monthly_maintenence_fee\": null, \"finished_sqft\": \"1256\", \"number_of_images\": 1, \"zipcode\": \"44714\", \"list_agent_id\": \"C391768\", \"state\": \"OH\", \"colisting_agent_id\": \"\"}", "{\"list_price\": 389900, \"number_of_bedrooms\": 3, \"formatted_list_price\": \"389,900\", \"address\": \"340 Cleveland Jacket Ct\", \"property_type\": \"Residential\", \"city\": \"Avon Lake\", \"mls_number\": 2507534, \"monthly_maintenence_fee\": null, \"finished_sqft\": \"2615\", \"number_of_images\": 2, \"zipcode\": \"44012\", \"list_agent_id\": \"323231\", \"state\": \"OH\", \"colisting_agent_id\": \"\"}", "{\"list_price\": 195000, \"number_of_bedrooms\": 3, \"formatted_list_price\": \"195,000\", \"address\": \"33234 Waterview Ct\", \"property_type\": \"Residential\", \"city\": \"Avon Lake\", \"mls_number\": 2506194, ..... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ... | |
| <script> | |
| Homes.reset({{ homes|jsonify }}) | |
| </script> | |
| ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django import template | |
| from django.utils.safestring import mark_safe | |
| import json | |
| register = template.Library() | |
| @register.filter | |
| def jsonify(list): | |
| flat = [item.to_json() for item in list] | |
| blob = json.dumps(flat) | |
| return mark_safe(blob) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment