GetTogether/get_together/templates/get_together/create_place.html

35 lines
932 B
HTML

{% extends "get_together/base.html" %}
{% block content %}
<h2>Choose your meeting place</h2>
<form action="{% url "create-place" %}" method="post">
{% csrf_token %}
<div class="form-group">
{% include "events/place_form.html" %}
<br />
<button type="submit" class="btn btn-primary">Save your Place</button>
</div>
</form>
{% endblock %}
{% block javascript %}
<script type="text/javascript">
$(document).ready(function(){
$("#city_search").keyup(function() {
var searchText = this.value;
$.getJSON("/api/cities/?q="+searchText, function(data) {
var searchField = $("#city_search")[0];
var q = this.url.match(/q=([^&]+)/)[1]
var c = searchField.value
if (c != q) return;
var selectField = $("#city_select");
selectField.empty();
$.each(data, function(){
selectField.append('<option value="'+ this.id +'">'+ this.display+ '</option>')
});
});
});
});
</script>
{% endblock %}