Code

Opened 6 years ago

Closed 6 years ago

#5881 closed (invalid)

ProgrammingError using "save as new" with inline models

Reported by: eduardo.padoan@… Owned by: nobody
Component: contrib.admin Version: master
Severity: Keywords: admin
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

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]

Attachments (0)

Change History (7)

comment:1 Changed 6 years ago by anonymous

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

I've reproduced this bug, with the Incorrect integer value Exception Value, though I'm getting a different Exception Type. I'm using revision [7253].

Warning at /admin/saveasnew/master/3/
Incorrect integer value: 'on' for column 'is_well' at row 1
Environment:

Request Method: POST
Request URL: http://localhost:8000/admin/saveasnew/master/3/
Django Version: 0.97-pre-SVN-7253
Python Version: 2.5.1
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'sprint.saveasnew']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.middleware.doc.XViewMiddleware')


Traceback:
File "/usr/local/lib/python2.5/site-packages/django/core/handlers/base.py" in get_response
  82.                 response = callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.5/site-packages/django/contrib/admin/views/decorators.py" in _checklogin
  62.             return view_func(request, *args, **kwargs)
File "/usr/local/lib/python2.5/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  44.         response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python2.5/site-packages/django/contrib/admin/views/main.py" in change_stage
  321.         return add_stage(request, app_label, model_name, form_url='../../add/')
File "/usr/local/lib/python2.5/site-packages/django/contrib/admin/views/decorators.py" in _checklogin
  62.             return view_func(request, *args, **kwargs)
File "/usr/local/lib/python2.5/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  44.         response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python2.5/site-packages/django/contrib/admin/views/main.py" in add_stage
  264.             new_object = manipulator.save(new_data)
File "/usr/local/lib/python2.5/site-packages/django/db/models/manipulators.py" in save
  201.                         new_rel_obj.save()
File "/usr/local/lib/python2.5/site-packages/django/db/models/base.py" in save
  264.                     ','.join(placeholders)), db_values)
File "/usr/local/lib/python2.5/site-packages/django/db/backends/util.py" in execute
  18.             return self.cursor.execute(sql, params)
File "/var/lib/python-support/python2.5/MySQLdb/cursors.py" in execute
  168.         if not self._defer_warnings: self._warning_check()
File "/var/lib/python-support/python2.5/MySQLdb/cursors.py" in _warning_check
  82.                     warn(w[-1], self.Warning, 3)

Exception Type: Warning at /admin/saveasnew/master/3/
Exception Value: Incorrect integer value: 'on' for column 'is_well' at row 1

comment:2 Changed 6 years ago by jefurii

oops, I'm not Anonymous.

comment:3 Changed 6 years ago by jefurii

  • Component changed from Uncategorized to Admin interface

comment:4 Changed 6 years ago by binnen@…

any news on this one? I get the same error ...

comment:5 Changed 6 years ago by jacob

  • Triage Stage changed from Unreviewed to Accepted

comment:6 Changed 6 years ago by edcrypt

This is a oldforms-admin issue. I guess it should be marked as fixed on current admin.

comment:7 Changed 6 years ago by jacob

  • Resolution set to invalid
  • Status changed from new to closed

Yeah, no longer valid. If this is still a problem with the new admin, open a new ticket.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.