#5881: ProgrammingError using "save as new" with inline models
-------------------------------------+--------------------------------------
Reporter:  [EMAIL PROTECTED]  |       Owner:  nobody       
  Status:  new                       |   Component:  Uncategorized
 Version:  SVN                       |    Keywords:  admin        
   Stage:  Unreviewed                |   Has_patch:  0            
-------------------------------------+--------------------------------------
 Cant use "Save as new" with editing model with 4 or more inline instances
 on admin.

 ----


 == To reproduce: ==



 1 - Create the models:

 {{{
 from django.db import models

 class Master(models.Model):
     name = models.CharField(max_length=20)

     class Admin:
         save_as = True

     class Meta:
         pass

 class Detail(models.Model):
     is_well = models.BooleanField(default=True)
     is_live = models.BooleanField(default=True)
     number = models.IntegerField(core=True)
     master = models.ForeignKey(Master, edit_inline=models.TABULAR)

     class Admin:
         save_as = True

     class Meta:
         pass
 }}}



 2 - On admin: create a master with '''4 details''' (yes, the exception is
 raised only when you have '''4''' or more instances of the inline model,
 with 'is_alive' and 'is_well' as True) - save with 'save and continue
 editing'

 3 - Try 'save as new'

 ----


 == Result: ==


 {{{
 '''
 ProgrammingError at /admin/bt/master/14/
 Sintaxe de entrada inválida para tipo boolean: "on"
 '''
 }}}

 (''invalid input syntax for boolean type: "on"'', or something like this,
 in english)

 {{{
 ''Request Method:       POST
 Request URL:    http://ubuntu:8000/admin/bt/master/14/
 Exception Type:         ProgrammingError
 Exception Value:        intaxe de entrada inválida para tipo boolean: "on"
 Exception Location:     /usr/lib/python2.4/site-
 packages/django/db/backends/util.py in execute, line 18
 Python Executable:      /usr/bin/python
 Python Version:         2.4.4''
 }}}


 More complete traceback:

 {{{
     *
       Variable  Value
       params
       [u'on', u'on', u'333', 17L]
       self
       <django.db.backends.util.CursorDebugWrapper object at 0x870110c>
       sql
       u'INSERT INTO "bt_detail" ("is_well","is_live","number","master_id")
 VALUES (\'on\',\'on\',\'333\',17)'
       start
       1194364572.2632771
       stop
       1194364572.2681961

 Traceback (most recent call last):
 File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py" in
 _real_get_response
   81. response = callback(request, *callback_args, **callback_kwargs)
 File "/usr/lib/python2.4/site-
 packages/django/contrib/admin/views/decorators.py" in _checklogin
   55. return view_func(request, *args, **kwargs)
 File "/usr/lib/python2.4/site-packages/django/views/decorators/cache.py"
 in _wrapped_view_func
   39. response = view_func(request, *args, **kwargs)
 File "/usr/lib/python2.4/site-packages/django/contrib/admin/views/main.py"
 in change_stage
   319. return add_stage(request, app_label, model_name,
 form_url='../../add/')
 File "/usr/lib/python2.4/site-
 packages/django/contrib/admin/views/decorators.py" in _checklogin
   55. return view_func(request, *args, **kwargs)
 File "/usr/lib/python2.4/site-packages/django/views/decorators/cache.py"
 in _wrapped_view_func
   39. response = view_func(request, *args, **kwargs)
 File "/usr/lib/python2.4/site-packages/django/contrib/admin/views/main.py"
 in add_stage
   261. new_object = manipulator.save(new_data)
 File "/usr/lib/python2.4/site-packages/django/db/models/manipulators.py"
 in save
   201. new_rel_obj.save()
 File "/usr/lib/python2.4/site-packages/django/db/models/base.py" in save
   259. ','.join(placeholders)), db_values)
 File "/usr/lib/python2.4/site-packages/django/db/backends/util.py" in
 execute
   18. return self.cursor.execute(sql, params)

   ProgrammingError at /admin/bt/master/14/
   intaxe de entrada inválida para tipo boolean: "on"
 }}}

 ----


 My django is at revision [6635]

-- 
Ticket URL: <http://code.djangoproject.com/ticket/5881>
Django Code <http://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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to