#25587: Django fails, when trying to save object "as new" with inlines objects 
and
form validation errors.
-------------------------------+--------------------
     Reporter:  user0007       |      Owner:  nobody
         Type:  Bug            |     Status:  new
    Component:  contrib.admin  |    Version:  1.7
     Severity:  Normal         |   Keywords:
 Triage Stage:  Unreviewed     |  Has patch:  0
Easy pickings:  0              |      UI/UX:  0
-------------------------------+--------------------
 Let's assume that I have one existing object in Django Admin with some
 related objects (inlines). When I try to create a clone (by clicking on
 "Save as new"), but there are some validation errors, Django will fail,
 after clicking "Save and continue editing".

 Everything works without inlines objects.

 Error:

 {{{
 django.db.models.fields in get_prep_value
 ValueError: invalid literal for int() with base 10: ''
 }}}

 Stacktrace (most recent call last):

 {{{
   File "django/core/handlers/base.py", line 113, in get_response
     response = callback(request, *callback_args, **callback_kwargs)
   File "django/contrib/admin/options.py", line 406, in wrapper
     return self.admin_site.admin_view(view)(*args, **kwargs)
   File "django/utils/decorators.py", line 91, in _wrapped_view
     response = view_func(request, *args, **kwargs)
   File "django/views/decorators/cache.py", line 89, in _wrapped_view_func
     response = view_func(request, *args, **kwargs)
   File "django/contrib/admin/sites.py", line 202, in inner
     return view(request, *args, **kwargs)
   File "django/utils/decorators.py", line 25, in _wrapper
     return bound_func(*args, **kwargs)
   File "django/utils/decorators.py", line 91, in _wrapped_view
     response = view_func(request, *args, **kwargs)
   File "django/utils/decorators.py", line 21, in bound_func
     return func(self, *args2, **kwargs2)
   File "django/db/transaction.py", line 223, in inner
     return func(*args, **kwargs)
   File "django/contrib/admin/options.py", line 1038, in add_view
     prefix=prefix, queryset=inline.queryset(request))
   File "www/forms.py", line 566, in __init__
     super(UczestnikAdminInlineFormset, self).__init__(*args, **kwargs)
   File "django/forms/models.py", line 720, in __init__
     queryset=qs, **kwargs)
   File "django/forms/models.py", line 441, in __init__
     super(BaseModelFormSet, self).__init__(**defaults)
   File "django/forms/formsets.py", line 56, in __init__
     self._construct_forms()
   File "django/forms/formsets.py", line 124, in _construct_forms
     self.forms.append(self._construct_form(i))
   File "django/forms/models.py", line 729, in _construct_form
     form = super(BaseInlineFormSet, self)._construct_form(i, **kwargs)
   File "django/forms/models.py", line 463, in _construct_form
     connection=connections[self.get_queryset().db])
   File "django/db/models/fields/__init__.py", line 340, in
 get_db_prep_lookup
     value = self.get_prep_lookup(lookup_type, value)
   File "django/db/models/fields/__init__.py", line 322, in get_prep_lookup
     return self.get_prep_value(value)
   File "django/db/models/fields/__init__.py", line 555, in get_prep_value
     return int(value)
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/25587>
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.7ea1ce8e6ed267978278c5f912fb3e49%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to