Ticket #12627: 12627.diff

File 12627.diff, 965 bytes (added by NicoEchaniz, 6 years ago)
  • django/forms/forms.py

    diff -r 56b52b25b4ed django/forms/forms.py
    a b  
    66from django.utils.copycompat import deepcopy
    77from django.utils.datastructures import SortedDict
    88from django.utils.html import conditional_escape
     9from django.utils.translation import ugettext_lazy as _
    910from django.utils.encoding import StrAndUnicode, smart_unicode, force_unicode
    1011from django.utils.safestring import mark_safe
    117118        Returns True if the form has no errors. Otherwise, False. If errors are
    118119        being ignored, returns False.
    119120        """
     121        if not self.fields:
     122            if not self._errors:
     123                self._errors = ErrorDict()
     124            self._errors[NON_FIELD_ERRORS] = self.error_class([_(u'No data was submitted.')])
    120126        return self.is_bound and not bool(self.errors)
    122128    def add_prefix(self, field_name):
Back to Top