This file contains 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
var getPosition = function (options) { | |
return new Promise(function (resolve, reject) { | |
navigator.geolocation.getCurrentPosition(resolve, reject, options); | |
}); | |
} | |
getPosition() | |
.then((position) => { | |
console.log(position); | |
}) |
This file contains 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.core.handlers.wsgi import WSGIRequest | |
from StringIO import StringIO | |
from django.contrib.auth.models import AnonymousUser | |
def GetFakeRequest(path='/', user=None): | |
""" Construct a fake request(WSGIRequest) object""" | |
req = WSGIRequest({ | |
'REQUEST_METHOD': 'GET', | |
'PATH_INFO': path, | |
'wsgi.input': StringIO()}) |