How to get a list of n no.of model entries from a model having m no.of entries
Indetail.....I have a model of 50 entries i want a query set of 6 ramdom entries from that 50 entries using built-in class based ListViews.
I am portfolio_list give me all the entries of model present but i need only random 6 entries for index list display.
views.py
class PortfolioListView(ListView):
model = Portfolio
template_name = 'portfolio/portfolio_index.html'
portfolio_list.html
{% block Body_Content %}
{% for item in portfolio_list %}
<div class="card-group">
{% include "portfolio/_portfolio.html" %}
</div>
{% endfor %}
{% endblock Body_Content %}