title: Django: How to reference a model's objects from a view
body: <p>I have a django ecommerce site that sells jewelry.  I have a <code>Product</code> model, with an associated <code>show_product</code> view, which is displayed by a <code>product.html</code> template.</p>
  
  <p>I now want to offer customizable charms with my jewelry.  To that end, I have created a <code>Charm</code> model which defines the name, image, SKU etc. of the charms.  I have also modified my <code>Product</code> model to include an <code>allows_charms</code> boolean value, since every charm is available on any product that allows charms in the first place.  In other words, I don't have to worry about relational mapping, because as long as a product ALLOWS charms, it allows ALL charms.</p>
  
  <p>My problem is arising in the <code>show_product</code> view.  How do I set a <code>charms</code> variable that contains all of the <code>Charm</code> model's objects, which I can then reference in my template, with code something like:</p>
  
  <pre><code>{% for ch in charms %}
  &lt;div class="charm_thumb"&gt;
       &lt;img src="{{ MEDIA_URL }}images/charms/{{ ch.image }}" alt="{{ ch.name }}" /&gt;
       &lt;p id="charm_name"&gt;{{ ch.name }}&lt;/p&gt;
       &lt;p id="charm_price"&gt;${{ ch.price }}&lt;/p&gt;
  &lt;/div&gt;
  {% endfor %}
  </code></pre>
  
  <p>I would know how to do this if I was grabbing a list of associated charms from a M2M relationship of an object of a product model, but I don't know how to grab EVERY object in a given model?</p>
  
  <p>To make my end-goal clear, I wish something like this, NON FUNCTIONAL, code would work:</p>
  
  <pre><code>from mystore import Charms
  charms = Charms.all()
  </code></pre>