#23674: form.changed_data breaks on invalid intial data.
-----------------------------------------+------------------------
               Reporter:  apollo13       |          Owner:  nobody
                   Type:  Uncategorized  |         Status:  new
              Component:  Forms          |        Version:  1.7
               Severity:  Normal         |       Keywords:
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  0
                  UI/UX:  0              |
-----------------------------------------+------------------------
 Traceback from the admin after the following steps (came up in IRC today):
 * Open http://localhost:8000/admin/auth/user/1/
 * Change "date joined" to an invalid date
 * Hit "save and continue editing" -- a normal form error is shown
 * Change the date back to a valid value and hit save
 * Get greeted by the following traceback:
 {{{
 Environment:


 Request Method: POST
 Request URL: http://localhost:8000/admin/auth/user/1/

 Django Version: 1.8.dev20141015153619
 Python Version: 2.7.8
 Installed Applications:
 ('django.contrib.admin',
  'django.contrib.auth',
  'django.contrib.contenttypes',
  'django.contrib.sessions',
  'django.contrib.messages',
  'django.contrib.staticfiles')
 Installed Middleware:
 ('django.contrib.sessions.middleware.SessionMiddleware',
  'django.middleware.common.CommonMiddleware',
  'django.middleware.csrf.CsrfViewMiddleware',
  'django.contrib.auth.middleware.AuthenticationMiddleware',
  'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
  'django.contrib.messages.middleware.MessageMiddleware',
  'django.middleware.clickjacking.XFrameOptionsMiddleware',
  'django.middleware.security.SecurityMiddleware')


 Traceback:
 File "/home/florian/sources/django.git/django/core/handlers/base.py" in
 get_response
   125.                     response = wrapped_callback(request,
 *callback_args, **callback_kwargs)
 File "/home/florian/sources/django.git/django/contrib/admin/options.py" in
 wrapper
   602.                 return self.admin_site.admin_view(view)(*args,
 **kwargs)
 File "/home/florian/sources/django.git/django/utils/decorators.py" in
 _wrapped_view
   110.                     response = view_func(request, *args, **kwargs)
 File "/home/florian/sources/django.git/django/views/decorators/cache.py"
 in _wrapped_view_func
   54.         response = view_func(request, *args, **kwargs)
 File "/home/florian/sources/django.git/django/contrib/admin/sites.py" in
 inner
   212.             return view(request, *args, **kwargs)
 File "/home/florian/sources/django.git/django/contrib/admin/options.py" in
 change_view
   1477.         return self.changeform_view(request, object_id, form_url,
 extra_context)
 File "/home/florian/sources/django.git/django/utils/decorators.py" in
 _wrapper
   34.             return bound_func(*args, **kwargs)
 File "/home/florian/sources/django.git/django/utils/decorators.py" in
 _wrapped_view
   110.                     response = view_func(request, *args, **kwargs)
 File "/home/florian/sources/django.git/django/utils/decorators.py" in
 bound_func
   30.                 return func.__get__(self, type(self))(*args2,
 **kwargs2)
 File "/home/florian/sources/django.git/django/utils/decorators.py" in
 inner
   145.                     return func(*args, **kwargs)
 File "/home/florian/sources/django.git/django/contrib/admin/options.py" in
 changeform_view
   1431.                     change_message =
 self.construct_change_message(request, form, formsets)
 File "/home/florian/sources/django.git/django/contrib/admin/options.py" in
 construct_change_message
   1006.         if form.changed_data:
 File "/home/florian/sources/django.git/django/forms/forms.py" in
 changed_data
   462.                 if field.has_changed(initial_value, data_value):
 File "/home/florian/sources/django.git/django/forms/fields.py" in
 has_changed
   1104.             if field.has_changed(field.to_python(initial), data):
 File "/home/florian/sources/django.git/django/forms/fields.py" in
 to_python
   483.         return super(TimeField, self).to_python(value)
 File "/home/florian/sources/django.git/django/forms/fields.py" in
 to_python
   437.         raise ValidationError(self.error_messages['invalid'],
 code='invalid')

 Exception Type: ValidationError at /admin/auth/user/1/
 Exception Value: [u'Enter a valid time.']

 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/23674>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.ec33a4df6f632854132e2cf1a93cad6a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to