1👍
Also you can use with
tag and ignore variable:
{% with ignorevar=Counter.increment %}{% endwith %}
1👍
This is a bit of a hack, but it would solve your problem:
{{ Counter.increment|yesno:"," }}
(See the documentation on the yesno
filter)
- [Answered ]-Django DecimalField "." instead of ","
- [Answered ]-Django: Contribute to third party app django-lazysignup
- [Answered ]-Django Editable Text Field
- [Answered ]-Select all records from the parent table assuming something is present in the child
- [Answered ]-Django – Model field property
0👍
If you only need the top five elements, then I think the right way is to send a list of only top 5 elements from your views to your your html templates in the very first place.
Also, if for some reason, you are not able to do that, then you should there is a thing in Django known as Template Tags where you do all your calculations.
See this -> https://docs.djangoproject.com/en/1.9/howto/custom-template-tags/
And finally if you still want to use Counter.increment, then simply put it inside a div say “count-flag” and using your javascript, hide that div forever on page load:
$(document).on('ready', function(){
$("#count-flag").hide();
}
So it will not be displayed on your html, but technically this is not the way to do it.
- [Answered ]-Django model with multiple choices
- [Answered ]-Django installation on MS Windows, manage.py "Couldn't import Django"
- [Answered ]-Working around SQLite's lack of named parameter support
- [Answered ]-Upload an image to twitter via tweepy from django form
- [Answered ]-Newbie – Django Project with Multiple Apps – Unable to render Views