﻿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
482	ForeignKey inline editing drops records in the Admin application	brovienas@…	Adrian Holovaty	"I am using the {{{ForeignKey}}} with inline editing.

 1. I have opened the admin editor tp modify an existing parent record
 1. I have added an entry to child record
 1. Saved
 1. Go to edit the parent record
 1. I now have 2 places to enter the data. The first one is populated with previous data. The second one is empty.
 1. I click save
 1. I get the exception as displayed below
 1. If I go back and refresh the parent record view - it does not contain any child entries anymore.

{{{
class Lankymas(meta.Model):
    nuo = meta.DateField(blank=True)
    iki = meta.DateField(blank=True, null=True)
    moksleivis = meta.ForeignKey(Moksleivis, edit_inline=meta.STACKED, num_in_admin=1)
    
    class META:        
        module_name='lankymai'
    
        
    def __repr__(self):
        return ""Nuo %s iki %s"" % (self.nuo, self.iki)

}}}

{{{
There's been an error:

Traceback (most recent call last):

  File ""/usr/lib/python2.3/site-packages/django/core/handlers/base.py"", line 64, in get_response
    response = callback(request, **param_dict)

  File ""/usr/lib/python2.3/site-packages/django/views/admin/main.py"", line 878, in change_stage
    new_object = manipulator.save(new_data)

  File ""/usr/lib/python2.3/site-packages/django/utils/functional.py"", line 3, in _curried
    return args[0](*(args[1:]+moreargs), **dict(kwargs.items() + morekwargs.items()))

  File ""/usr/lib/python2.3/site-packages/django/core/meta/__init__.py"", line 1549, in manipulator_save
    new_rel_obj.save()

  File ""/usr/lib/python2.3/site-packages/django/utils/functional.py"", line 3, in _curried
    return args[0](*(args[1:]+moreargs), **dict(kwargs.items() + morekwargs.items()))

  File ""/usr/lib/python2.3/site-packages/django/core/meta/__init__.py"", line 801, in method_save
    ','.join(field_names), ','.join(placeholders)), db_values)

  File ""/usr/lib/python2.3/site-packages/django/core/db/base.py"", line 10, in execute
    result = self.cursor.execute(sql, params)

  File ""/usr/lib/python2.3/site-packages/MySQLdb/cursors.py"", line 137, in execute
    self.errorhandler(self, exc, value)

  File ""/usr/lib/python2.3/site-packages/MySQLdb/connections.py"", line 33, in defaulterrorhandler
    raise errorclass, errorvalue

OperationalError: (1048, ""Column 'nuo' cannot be null"")

}}}

"	defect	closed	Core (Cache system)		normal	invalid			Accepted	0	0	0	0	0	0
