...
ars1 = arsenal_item.get_persent_answer1()
@property
def get_persent_answer1(self):
per1 = round(self.answer_number1 * 100 / (self.answer_number1 + self.answer_number2 + self.answer_number3), 1)
return per1
...
<a id="up_com_video_like" data-comid="{{ com.id }}" class="comments_social_thumb" href="{% url "upvideocomlike" com.id %}"></a
$('#up_com_video_like').click(function(e){
e.preventDefault();
$.ajax({
url: '{% url "upvideocomlike" com.id %}',
data: {'pk': $(this).attr('data-comid'), 'csrfmiddlewaretoken': '{{ csrf_token }}'},
success: function(data){
$('#main_like_number').html(data.count_like)
}
});
});
Sample.objects.filter(sampledate__gt=datetime.date(2011, 1, 1),
sampledate__lt=datetime.date(2011, 1, 31))
Sample.objects.filter(date__range=["2011-01-01", "2011-01-31"])
if request.is_ajax():
JsonResponse(
# data, encoder=DjangoJSONEncoder,
safe=False,
# json_dumps_params=None,
{'like_counter': 42})