Opened 18 years ago

Closed 17 years ago

#4621 closed (duplicate)

trouble on empty classes/tables in the admininterface

Reported by: bionic@… Owned by: nobody
Component: contrib.admin Version: 0.96
Severity: Keywords: checks
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

i have created on class in the app-folder:

models.py

class Foobar(models.Model):

class Admin:

pass

if i do a python manage.py syncdb is all fine the table would be created and all is fine.

BEGIN;
CREATE TABLE "polls_foobar" (

"id" serial NOT NULL PRIMARY KEY

);
COMMIT;

if i connect to the webinterface for this table and try to add try to add an entry django throws an expection:

IndexError at /admin/polls/foobar/add/
list index out of range
Request Method: GET
Request URL: http://127.0.0.1:8000/admin/polls/foobar/add/
Exception Type: IndexError
Exception Value: list index out of range
Exception Location: /var/lib/python-support/python2.4/django/contrib/admin/views/main.py in render_change_form, line 196

----------------------------------------------

Traceback (most recent call last):
File "/var/lib/python-support/python2.4/django/core/handlers/base.py" in get_response

  1. response = callback(request, *callback_args, callback_kwargs)

File "/var/lib/python-support/python2.4/django/contrib/admin/views/decorators.py" in _checklogin

  1. return view_func(request, *args, kwargs)

File "/var/lib/python-support/python2.4/django/views/decorators/cache.py" in _wrapped_view_func

  1. response = view_func(request, *args, kwargs)

File "/var/lib/python-support/python2.4/django/contrib/admin/views/main.py" in add_stage

  1. return render_change_form(model, manipulator, c, add=True)

File "/var/lib/python-support/python2.4/django/contrib/admin/views/main.py" in render_change_form

  1. first_form_field_id = bound_field_sets[0].bound_field_lines[0].bound_fields[0].form_fields[0].get_id();

IndexError at /admin/polls/foobar/add/
list index out of range


if i guess right that django would not check if an table is empty?

Michael Dierks

Change History (1)

comment:1 by James Bennett, 17 years ago

Resolution: duplicate
Status: newclosed

Feels like a duplicate of #1972.

Note: See TracTickets for help on using tickets.
Back to Top