﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
4621	trouble on empty classes/tables in the admininterface	bionic@…	nobody	"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
  77. response = callback(request, *callback_args, **callback_kwargs)
File ""/var/lib/python-support/python2.4/django/contrib/admin/views/decorators.py"" in _checklogin
  55. return view_func(request, *args, **kwargs)
File ""/var/lib/python-support/python2.4/django/views/decorators/cache.py"" in _wrapped_view_func
  39. response = view_func(request, *args, **kwargs)
File ""/var/lib/python-support/python2.4/django/contrib/admin/views/main.py"" in add_stage
  298. 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
  196. 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"		closed	contrib.admin	0.96		duplicate	checks		Unreviewed	0	0	0	0	0	0
