Change prediction_windows request to POST request
parent
2a8136b8bd
commit
686e7f435d
|
@ -16,12 +16,7 @@ base_urlpatterns = ([
|
|||
url(r'^observations/(?P<id>[0-9]+)/delete/$', views.observation_delete,
|
||||
name='observation_delete'),
|
||||
url(r'^observations/new/$', views.observation_new, name='observation_new'),
|
||||
url(r'^prediction_windows/(?P<sat_id>[\w.@+-]+)/(?P<transmitter>[\w.@+-]+)/'
|
||||
r'(?P<start_date>.+)/(?P<end_date>.+)/(?P<station_id>[\w.@+-]+)/$',
|
||||
views.prediction_windows, name='prediction_windows_filtered'),
|
||||
url(r'^prediction_windows/(?P<sat_id>[\w.@+-]+)/(?P<transmitter>[\w.@+-]+)/'
|
||||
r'(?P<start_date>.+)/(?P<end_date>.+)/$',
|
||||
views.prediction_windows, name='prediction_windows'),
|
||||
url(r'^prediction_windows/$', views.prediction_windows, name='prediction_windows'),
|
||||
url(r'^pass_predictions/(?P<id>[\w.@+-]+)/$',
|
||||
views.pass_predictions, name='pass_predictions'),
|
||||
url(r'^observation_vet/(?P<id>[0-9]+)/(?P<status>[a-z]+)/$', views.observation_vet,
|
||||
|
|
|
@ -383,8 +383,12 @@ def observation_new(request):
|
|||
|
||||
|
||||
@ajax_required
|
||||
def prediction_windows(request, sat_id, transmitter, start_date, end_date,
|
||||
station_id=None):
|
||||
def prediction_windows(request):
|
||||
sat_id = request.POST['satellite']
|
||||
transmitter = request.POST['transmitter']
|
||||
start_date = request.POST['start_time']
|
||||
end_date = request.POST['end_time']
|
||||
station_id = request.POST.get('station_id', None)
|
||||
try:
|
||||
sat = Satellite.objects.filter(transmitters__alive=True) \
|
||||
.filter(status='alive').distinct().get(norad_cat_id=sat_id)
|
||||
|
|
|
@ -212,10 +212,14 @@ $(document).ready( function(){
|
|||
var transmitter = $('#transmitter-selection').find(':selected').val();
|
||||
var satellite = $('#satellite-selection').val();
|
||||
|
||||
var url = '/prediction_windows/' + satellite + '/' + transmitter + '/' + start_time + '/' + end_time + '/';
|
||||
|
||||
var url = '/prediction_windows/';
|
||||
var data = {};
|
||||
data.satellite = satellite;
|
||||
data.transmitter = transmitter;
|
||||
data.start_time =start_time;
|
||||
data.end_time = end_time;
|
||||
if (obs_filter_station) {
|
||||
url = '/prediction_windows/' + satellite + '/' + transmitter + '/' + start_time + '/' + end_time + '/' + obs_filter_station + '/';
|
||||
data.station_id = obs_filter_station;
|
||||
}
|
||||
if (satellite.length == 0) {
|
||||
$('#windows-data').html('<span class="text-danger">You should select a Satellite first.</span>');
|
||||
|
@ -226,8 +230,14 @@ $(document).ready( function(){
|
|||
}
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: url,
|
||||
beforeSend: function() { $('#loading').show(); }
|
||||
data: data,
|
||||
dataType: 'json',
|
||||
beforeSend: function(xhr) {
|
||||
xhr.setRequestHeader('X-CSRFToken', $('[name="csrfmiddlewaretoken"]').val());
|
||||
$('#loading').show();
|
||||
}
|
||||
}).done(function(data) {
|
||||
$('#loading').hide();
|
||||
if (data.length == 1 && data[0].error) {
|
||||
|
|
Loading…
Reference in New Issue