Fix stations map view in home page to use new API.
parent
0a077979bf
commit
7ef047a403
|
@ -49,7 +49,7 @@ class SatelliteFactory(factory.django.DjangoModelFactory):
|
|||
name = fuzzy.FuzzyText()
|
||||
tle = fuzzy.FuzzyText()
|
||||
updated = fuzzy.FuzzyDateTime(now() - timedelta(days=3),
|
||||
now() + timedelta(days=3))
|
||||
now() + timedelta(days=3))
|
||||
|
||||
class Meta:
|
||||
model = Satellite
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
from django.shortcuts import get_object_or_404, render
|
||||
from django.utils.timezone import now
|
||||
from django.core import serializers
|
||||
|
||||
from django.http import HttpResponse
|
||||
|
||||
|
||||
from base.models import Station, Observation, Data
|
||||
|
@ -29,12 +26,6 @@ def observations_list(request):
|
|||
return render(request, 'base/observations.html', {'observations': observations})
|
||||
|
||||
|
||||
def stations_json(request):
|
||||
data = serializers.serialize('json', Station.objects.all())
|
||||
|
||||
return HttpResponse(data, content_type='application/json')
|
||||
|
||||
|
||||
def view_observation(request, id):
|
||||
"""View for single observation page."""
|
||||
observation = get_object_or_404(Observation, id=id)
|
||||
|
|
|
@ -11,7 +11,7 @@ $(document).ready(function() {
|
|||
})
|
||||
|
||||
$.ajax({
|
||||
url: "/stations/json"
|
||||
url: "/api/stations/?format=json"
|
||||
}).done(function(data) {
|
||||
data.forEach(function(m) {
|
||||
L.mapbox.featureLayer({
|
||||
|
@ -19,12 +19,12 @@ $(document).ready(function() {
|
|||
geometry: {
|
||||
type: 'Point',
|
||||
coordinates: [
|
||||
parseFloat(m.fields.lng),
|
||||
parseFloat(m.fields.lat)
|
||||
parseFloat(m.lng),
|
||||
parseFloat(m.lat)
|
||||
]
|
||||
},
|
||||
properties: {
|
||||
title: m.fields.name,
|
||||
title: m.name,
|
||||
'marker-size': 'large',
|
||||
'marker-color': '#666',
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ admin.autodiscover()
|
|||
urlpatterns = patterns(
|
||||
'',
|
||||
url(r'^$', 'base.views.index', name='home'),
|
||||
url(r'^stations/json/$', 'base.views.stations_json', name='stations_json'),
|
||||
|
||||
# Observations
|
||||
url(r'^o/(?P<id>[0-9]+)/$',
|
||||
|
|
Loading…
Reference in New Issue