title: How do you limit list objects template side, rather than view side
body: <p>One of the ways to limit objects is to add a limitation to a function like this</p>
  
  <pre><code>def ten_objects():
      obj = Model.objects.all()[0:10]  # limit to 10
      return {'objects': obj}
  </code></pre>
  
  <p>However how do you achieve this inside a template rather than inside a view? </p>
  
  <p>I know you can filter through objects within a template and limit characters but how do you actually limit the amount of objects displayed in a loop. Via the template. for example the following code will loop through all objects....</p>
  
  <pre><code>    &lt;ul&gt;
       {% for new in news %}
        &lt;li&gt;
         &lt;p&gt;{{ news.title }}&lt;/p&gt;
         &lt;p&gt;{{ news.body }}&lt;/p&gt;
        &lt;/li&gt;
       {% endfor %}
      &lt;/ul&gt;
  </code></pre>
  
  <p>How do I break the loop, say after the firs 3 objects/items. And how do I do it inside the template. Thanks in advance.</p>