title: Let object state decide form_class in Django
body: <p>I have a manager</p>
  
  <pre><code>class OrderManager(models.Manager):
      STATE_REQUESTED = 0
      STATE_PROCESSED = 1
      STATE_CONFIRMED = 2
      STATE_CHOICES = [
          (STATE_REQUESTED, _('Requested')),
          (STATE_PROCESSED, _('Processing')),
          (STATE_CONFIRMED, _('Confirmed')),
      ]
  
      def requested(self):
          return self.filter(state=self.STATE_REQUESTED)
  </code></pre>
  
  <p>In want different <code>UpdateView</code> for each state in which an order can be.</p>
  
  <p>What is the best way to control this? I can make a view for each state, e.g. <code>RequestOrderView</code>, <code>ProcessOrderView</code>, and <code>ConfirmOrderView</code>. But how do I check in the template which view the link should point at?</p>
  
  <p>How do I check if an object is in a specific state both in views and in template? I guess I can populate the template with a queryset with <code>context['requested_orders'] = Order.objects.requested()</code> and check in template with</p>
  
  <pre><code>{% if object in requested_orders %}
  ...
  &lt;a href="{% url 'process_order' object.id %}"&gt;Process order&lt;/a&gt;
  ...
  {% elif object in processed_orders %}
  ...
  &lt;a href="{% url 'confirm_order' object.id %}"&gt;Confirm order&lt;/a&gt;
  ...
  {% endif %}
  </code></pre>
  
  <p>but is it a clever way to do this?</p>