Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>A few ideas:</p> <ol> <li>You could split your one big html form element into chunks</li> <li>You could use AJAX submit handler to change URL based on pressed submit button </li> <li>You could do what user <code>Cerales</code> suggested, but instead of redirecting which loses POST data you could just call <code>add_school()</code> and other methods, possibly having also dictionary map of actions mapped to their handlers: <code>action_map = {'Add School': add_school, ...}</code> - this would eliminate chain of conditions</li> <li>You could use class-based view which would be basically a class-based version of #3. Django docs for generic class-based views are <a href="https://docs.djangoproject.com/en/dev/ref/class-based-views" rel="nofollow">here</a></li> </ol> <p>I can elaborate on any of those ideas if you will.</p> <p>--</p> <p>EDIT:</p> <p>Answering your question from comments:</p> <pre><code>from django.views.generic.base import View class MySchoolView(View): def post(self, request, *kargs, **kwargs): if 'Add School' in request.POST: return self.add_school(request, *kargs, **kwargs) # (...) def add_school(self, request, *kargs, **kwargs): # (...) </code></pre> <p>Then in urls.py:</p> <pre><code>(r'^schools/add/$', MySchoolView.as_view()) </code></pre> <p>Note that the above is not tested so might require some tweaks to work. <code>View</code> class source code is <a href="https://code.djangoproject.com/browser/django/tags/releases/1.3/django/views/generic/base.py#L12" rel="nofollow">here</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload