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
| class ModelResource(Resource): | |
| """ | |
| A subclass of ``Resource`` designed to work with Django's ``Models``. | |
| This class will introspect a given ``Model`` and build a field list based | |
| on the fields found on the model (excluding relational fields). | |
| Given that it is aware of Django's ORM, it also handles the CRUD data | |
| operations of the resource. | |
| """ |
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
| +----+-------------+-------+--------+--------------------------+--------------------------+---------+-------------------+------+----------------------------------------------+ | |
| | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | | |
| +----+-------------+-------+--------+--------------------------+--------------------------+---------+-------------------+------+----------------------------------------------+ | |
| | 1 | SIMPLE | w | index | stats_workout_fbfc09f1 | stats_workout_fbfc09f1 | 4 | NULL | 32 | Using index; Using temporary; Using filesort | | |
| | 1 | SIMPLE | pr | eq_ref | user_id | user_id | 4 | athlete.w.user_id | 1 | Using index | | |
| | 1 | SIMPLE | p | ref | workout_id | workout_id | 5 | athlete.w.id | 1 | Using index |
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
| +----+-------------+-------+--------+------------------------+------------------------+---------+-------------------+------+----------------------------------------------+ | |
| | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | | |
| +----+-------------+-------+--------+------------------------+------------------------+---------+-------------------+------+----------------------------------------------+ | |
| | 1 | SIMPLE | w | index | stats_workout_fbfc09f1 | stats_workout_fbfc09f1 | 4 | NULL | 32 | Using index; Using temporary; Using filesort | | |
| | 1 | SIMPLE | pr | eq_ref | user_id | user_id | 4 | athlete.w.user_id | 1 | Using index | | |
| | 1 | SIMPLE | p | ref | workout_id | workout_id | 5 | athlete.w.id | 1 | Using index |
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
| { | |
| "query" : { | |
| "bool":{ | |
| "must" :[ | |
| {"query_string" : {"query" : "Sam*"}}, | |
| {"term" : { "subcategoria" : "monitores" }}, | |
| {"term" : { "resolucion_pantalla" : "1024x768" }} | |
| ] | |
| } | |
| }, |
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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <gpx version="1.1" creator="Exported from Strava" | |
| xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://www.garmin.com/xmlschemas/GpxExtensions/v3 http://www.garmin.com/xmlschemas/GpxExtensionsv3.xsd http://www.garmin.com/xmlschemas/TrackPointExtension/v1 http://www.garmin.com/xmlschemas/TrackPointExtensionv1.xsd" | |
| xmlns="http://www.topografix.com/GPX/1/1" | |
| xmlns:gpxtpx="http://www.garmin.com/xmlschemas/TrackPointExtension/v1" | |
| xmlns:gpxx="http://www.garmin.com/xmlschemas/GpxExtensions/v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |
| <metadata> | |
| <link href="http://cosmocatalano.com/strava-gpx-export"> | |
| <text>Cosmo's Strava GPX Exporter</text> | |
| </link> |
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
| { | |
| "run_date": "1970-01-01T00:00:00Z", | |
| "title": "Run Title!", | |
| "run_type": "Endurance", | |
| "duration_in_seconds": 3600, | |
| "distance_in_meters": 1000, | |
| "post_body": "This is the body, in order to provide a full description of your run", | |
| "points": [ | |
| { | |
| "lng":"-111.5373066", |
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
| { | |
| "run_date": "1970-01-01T00:00:00Z", | |
| "run_type": "Endurance", | |
| "title": "Run Title!", | |
| "distance_in_meters": 1000, | |
| "duration_in_seconds": 3600, | |
| "post_body": "This is the body, in order to provide a full description of your run", | |
| "points": [ | |
| { |
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
| [ | |
| { | |
| "lng": "-111.5373066", | |
| "lat": "40.7231711", | |
| "time": "1970-01-01T00:00:04Z", | |
| "elev": "1942.1789265256325" | |
| }, | |
| { | |
| "lng": "-111.5372056", | |
| "lat": "40.7228762", |
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
| """ This is a quick fix to provide full dehydration by demand | |
| on Django Tastypie. | |
| In order to use it you can query for: | |
| /api/v1/user/1/full=True | |
| """ | |
| class RelatedResource(ModelResource): |
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
| -- Query 1 | |
| SELECT id, distance_in_meters from stats_workout s1 | |
| WHERE distance_in_meters > (SELECT distance_in_meters FROM stats_workout WHERE id=3) | |
| ORDER BY distance_in_meters DESC; | |
| -- Query 2 | |
| SELECT DISTINCT s1.id, s1.distance_in_meters from stats_workout s1 | |
| JOIN stats_workout s2 ON (s1.distance_in_meters > s2.distance_in_meters) |