<div class="col-md-8" id="notesColumn">
{% crispy note_form %}
{% include 'item/item_notes.html' %}
</div>
the included template:
<div class="panel-group panel-group-simple m-b-0" id="notesList" aria-multiselectable="true" role="tablist">
{% for note in object.itemnote_set.all reversed %}
<div class="panel">
<div class="panel-heading" id="noteHeading{{ forloop.counter }}" role="tab">
<a class="panel-title collapsed" data-parent="#notesList"
data-toggle="collapse" href="#noteCollapse{{ forloop.counter }}"
aria-controls="noteCollapse{{ forloop.counter }}" aria-expanded="false">
<span class="tag tag-default">{{ note.owner.first_name }}</span>
{{ note.get_action_display|upper }}
<small class="panel-actions">{{ note.date_added }}</small>
</a>
</div>
<div class="panel-collapse collapse" id="noteCollapse{{ forloop.counter }}"
aria-labelledby="noteHeading{{ forloop.counter }}" role="tabpanel" aria-expanded="false"
style="height: 0px;">
<div class="panel-body">
{{ note.content }}
</div>
</div>
</div>
{% endfor %}
</div>
$("#notesTab form").submit(function(event){
console.log("submitting form")
// prevent page from being submitted and reloaded
event.preventDefault();
$('#notesList').remove();
console.log('old notes removed')
//var new_notes = '{% url candidate_notes %}';
//console.log(new_notes);
$.ajax({
url: "{% url candidate_notes %}",
success: function(data){
$('#notesColumn').html('data');
}
})
views.py
def candidate_notes(request):
return render_to_response(request, 'candidate/candidate_notes.html')
urls.py
url(r'item/notes', views.item_notes, name='item_notes'),Can yomeone please point me in the right direction? Thanks!!