title: Why is form.is_valid() evaluating false on POST request
body: <p>I am struggling with some prototype/test/learn like android app, that is supposed to <code>GET</code> and <code>POST</code> requests to a database via json/rest and django. I installed restless for django and the <code>GET</code> request is working like a charm.</p>
  
  <p>models.py</p>
  
  <pre><code>...
  class Exercise(models.Model):
  name = models.TextField()
  duration = models.TextField()
  repeats = models.TextField()
  creationtime = models.TextField()
  pausetime = models.TextField()
  alarmsound = models.TextField()
  description = models.TextField()
  type = models.TextField()
  ...
  </code></pre>
  
  <p>views.py</p>
  
  <pre><code>....
  from restless.views import Endpoint
  from restless.models import serialize
  from restless.http import Http201, Http400
  from .models import *
  from restinterface.forms import ExerciseForm
  
  class ExercisesList(Endpoint):
      def get(self, request):
          return serialize(Exercise.objects.all())
  ...
  </code></pre>
  
  <p>So, for the POST request, I implemented this little form: </p>
  
  <pre><code>from django import forms
  from .models import *
  class ExerciseForm(forms.ModelForm):
      class Meta:
          model = Exercise
  </code></pre>
  
  <p>On the android side I am creating a <code>List&lt;NameValuePair&gt;</code> which is then transformed into a <code>UrlEncodedFormEntity</code>. Sending it over to django also seems to work, but then on the django side a HTTP 500 gets thrown. </p>
  
  <pre><code>class ExercisesList(Endpoint):
  def get(self, request):
      return serialize(Exercise.objects.all())
  
  def post(self, request):
      form = ExerciseForm(request.data)
  
      # USED TO TEST IF SAVE ACTUALLY WORKS - and it does work!!!
      exercise = form.save()
  
      if form.is_valid():
          print 'Form seems to be valid ' + form.data
          exercise = form.save()
          return Http201(serialize(exercise))
      else:
          print 'Form seems to be invalid ' + form.data
          print 'invalid data'
          return Http400(reason='invalid author data',
              details=form.errors)
  </code></pre>
  
  <p>sample output: </p>
  
  <pre><code>[06/Jun/2014 02:38:43] "GET /exercises/ HTTP/1.1" 200 220
  [{'name': u'Campusboard', 'creationtime': '12', 'duration': u'no duration', 'pausetime': u'20', 'repeats':     u'5', 'type': u'repeat', u'id': 1, 'alarmsound': u'default', 'description':     u'this is a description'}]
  
  [06/Jun/2014 02:38:49] "POST /exercises/ HTTP/1.1" 500 672
  {u'name': u'Ringe', u'creationtime': u'12', u'duration': u'no     duration', u'pausetime': u'10', u'repeats': u'23', u'type': u'repeats',     u'alarmsound': u'default', u'description': u'this is a descpription'}
  </code></pre>
  
  <p>it looks like <code>form.is_valid()</code> always evaluates false. Does anyone know what I am doing wrong here? I would also interested in getting more debugging output then the one posted above. The debug flag is already activated! </p>
  
  <p>Cheers! </p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Guess I will try to use a different approach, and keep you updated.
  - switched the framework (as I am in a bit of a hurry), using django rest framework which is working perfectly for my purposes. </p>