Hi, I've got a master-detail relationship that I'm trying to get working in the Admin interface. My models are as follows:
class Account(meta.Model): name = meta.CharField(maxlength=100, null=False, unique=True) email = meta.EmailField(null=False) password = meta.CharField(maxlength=100, null=False) created_on = meta.DateTimeField(auto_now_add=True) updated_on = meta.DateTimeField(auto_now=True) class META: get_latest_by = 'updated_on' admin = meta.Admin( fields = ( (None, {'fields': ('name', 'email', 'password')}), ), list_display = ('name', 'email', 'created_on', 'updated_on'), ) def __repr__(self): return self.name class Project(meta.Model): name = meta.CharField(maxlength=100, null=False, core=True) account = meta.ForeignKey(Account, null=False, edit_inline=meta.TABULAR, num_in_admin=3) created_on = meta.DateTimeField(auto_now_add=True) updated_on = meta.DateTimeField(auto_now=True) class META: get_latest_by = 'updated_on' def __repr__(self): return self.name When I perform the following steps: 1. Create a new account 2. Add a project to the account 3. Hit "Save" It works. But when I go back into the "Account" detail page and add another "Project" object it fails complaining about the "CREATED_ON" column being null. The stacktrace looks like this: Traceback (most recent call last): File "d:\python24\lib\site-packages\Django-0.91-py2.4.egg\django\core\handlers\base.py" in get_response 74. response = callback(request, *callback_args, **callback_kwargs) File "d:\python24\lib\site-packages\Django-0.91-py2.4.egg\django\contrib\admin\views\decorators.py" in _checklogin 54. return view_func(request, *args, **kwargs) File "d:\python24\lib\site-packages\Django-0.91-py2.4.egg\django\contrib\admin\views\main.py" in change_stage 487. new_object = manipulator.save(new_data) File "d:\python24\lib\site-packages\Django-0.91-py2.4.egg\django\utils\functional.py" in _curried 3. return args[0](*(args[1:]+moreargs), **dict(kwargs.items() + morekwargs.items())) File "d:\python24\lib\site-packages\Django-0.91-py2.4.egg\django\core\meta\__init__.py" in manipulator_save 1869. new_rel_obj.save() File "d:\python24\lib\site-packages\Django-0.91-py2.4.egg\django\utils\functional.py" in _curried 3. return args[0](*(args[1:]+moreargs), **dict(kwargs.items() + morekwargs.items())) File "d:\python24\lib\site-packages\Django-0.91-py2.4.egg\django\core\meta\__init__.py" in method_save 1007. db_values + [pk_val]) File "d:\python24\lib\site-packages\Django-0.91-py2.4.egg\django\core\db\base.py" in execute 10. result = self.cursor.execute(sql, params) File "d:\python24\lib\site-packages\Django-0.91-py2.4.egg\django\core\db\backends\mysql.py" in execute 32. return self.cursor.execute(sql, params) File "D:\Python24\Lib\site-packages\MySQLdb\cursors.py" in execute 137. self.errorhandler(self, exc, value) File "D:\Python24\Lib\site-packages\MySQLdb\connections.py" in defaulterrorhandler 33. raise errorclass, errorvalue OperationalError at /admin/organizer/accounts/2/ (1263, "Column set to default value; NULL supplied to NOT NULL column 'created_on' at row 1") Any ideas ? Many thanks folks, Ijonas Kisselbach. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---