title: Django: View didn't return an HttpResponse object. It returned None instead
body: <p>Basically I would like a user to input a number in a field and the fibonacci result to be printed but once the input is inserted into the input field I recieve that it returned None instead of an object</p>
  
  <p>I have this code over here for my html form:</p>
  
  <pre><code>{% block content %}
    &lt;form method="POST" action="."&gt;{% csrf_token %}
       &lt;input type="text" name="fcal" value="{{F}}" /&gt;
     &lt;p&gt;
      &lt;input type="submit" name="fibo" value="Fibonacci" /&gt;
     &lt;/p&gt;
    &lt;/form&gt;
    {% if cal %}
       Your Fibonacci answer is {{cal}}
    {% endif %}
  {% endblock %}
  </code></pre>
  
  <p>The content of my views.py is this one:</p>
  
  <pre><code>from django.shortcuts import render_to_response, get_object_or_404, render
  from django.forms import ModelForm
  from django.http import HttpResponse, Http404, HttpResponseRedirect, HttpResponseNotFound
  import fibonacci
  
  
  def fibocal(request):
  if request.method == 'POST':
     fb = request.POST['fcal']
     cal = fibonacci.fibo(fb)
     return render(request, 'fibb/fibb.html', {'cal': cal})
  else:
     return render(request, 'fibb/fibb.html', {})
  </code></pre>
  
  <p>And my fibonacci function is this one: </p>
  
  <pre><code>def fibo(n):
      if n == 0:
         return 0
      elif n == 1:
         return 1
      else:
          result = fibo(n - 1) + fibo(n - 2)
          return result
  </code></pre>
  
  <p>I would like to know where the error is caused as I've looked again and again and I can see that I am returning a render not None</p>
  
  <p>Full traceback include:</p>
  
  <pre><code>Traceback:
  
  File "C:\python35\lib\site-packages\django\core\handlers\base.py" in get_response
  158. % (callback.__module__, view_name))
  
  Exception Type: ValueError at /fibb/
  Exception Value: The view fibb.views.fibb didn't return an HttpResponse object. It returned None instead.
  </code></pre>