﻿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
3765	Exception when adding a new record in the admin form with related recordss	ross@…	Adrian Holovaty	"With this model:
{{{
from django.db import models

class Paper(models.Model):
    class Admin:
        pass

    title = models.CharField(maxlength=200)
    
    def __str__(paper):
        return paper.title
    
class Note(models.Model):
    paper = models.ForeignKey(Paper, edit_inline=models.STACKED, num_in_admin=1)
    text = models.TextField(""Comments"", core=True)

}}}

If I go the the admin site, add a new Paper, enter a title and leave the Note Comments field blank, when I press Save I get this exception:
{{{
Traceback (most recent call last):
File ""/home/ross/bin/BUILD/lib/python2.5/site-packages/django/core/handlers/base.py"" in get_response
  77. response = callback(request, *callback_args, **callback_kwargs)
File ""/home/ross/bin/BUILD/lib/python2.5/site-packages/django/contrib/admin/views/decorators.py"" in _checklogin
  55. return view_func(request, *args, **kwargs)
File ""/home/ross/bin/BUILD/lib/python2.5/site-packages/django/views/decorators/cache.py"" in _wrapped_view_func
  39. response = view_func(request, *args, **kwargs)
File ""/home/ross/bin/BUILD/lib/python2.5/site-packages/django/contrib/admin/views/main.py"" in add_stage
  254. new_object = manipulator.save(new_data)
File ""/home/ross/bin/BUILD/lib/python2.5/site-packages/django/db/models/manipulators.py"" in save
  172. if f.core and not isinstance(f, FileField) and f.get_manipulator_new_data(rel_new_data, rel=True) in (None, ''):
File ""/home/ross/bin/BUILD/lib/python2.5/site-packages/django/db/models/fields/__init__.py"" in get_manipulator_new_data
  289. return new_data.get(self.name, [self.get_default()])[0]

  IndexError at /admin/papers/paper/add/
  string index out of range
}}}

The problem is that new_data.get() returns """", and then doing [0] throws the IndexError.

I can replicate this with Django 0.95.1 and svn (rev 4752).  I'm using sqlite3 as a database, Python 2.5 on Ubuntu Feisty Fawn."		closed	contrib.admin	dev		invalid			Unreviewed	1	0	1	1	0	0
