title: argument of type 'NoneType' is not iterable in django froms
body: <pre><code>def clean(self):
        """ 
        Override the default clean method to check whether this course has been already inputted.
        """    
        cleaned_data = super(tbmstappraisalschedForm, self).clean()
        #appsched_id = str(self.cleaned_data.get('intAppSchedID'))
        depart_id = self.cleaned_data.get('intDeptID')
        fromdate = str(self.cleaned_data.get('sdtFromDate'))
        todate = str(self.cleaned_data.get('todate'))
        pk=self.instance.pk
        #if tbmstappraisalsched.objects.filter(intDeptID=depart_id).exclude(pk=self.instance.pk).exists():
        #qry = "SELECT intAppSchedID FROM tbMstAppraisalSched WHERE intDeptID ='"+depart_id+"' AND (('"+fromdate+"' BETWEEN  sdtFromDate AND  sdtToDate) OR ('"+todate+"' BETWEEN  sdtFromDate AND sdtToDate))"
        qry = """SELECT intAppSchedID FROM tbMstAppraisalSched WHERE intDeptID = '{}' AND (('{}' BETWEEN sdtFromDate AND sdtToDate) OR ('{}' BETWEEN sdtFromDate and sdtToDate))"""
        res = tbmstappraisalsched.objects.raw(qry.format(depart_id.pk, fromdate, todate))
        for re in res:
          if(re.intAppSchedID != pk):
              msg = "The slot for selected department and selected dates exists"
              raise ValidationError(msg)
          else:
              return self.cleaned_data
  </code></pre>
  
  <p>if there are no rows return in query then it is raising a exception 
  Exception Type: TypeError
  Exception Value:<br>
  argument of type 'NoneType' is not iterable
  Thanks in advance</p>