Opened 14 years ago

Closed 14 years ago

Last modified 12 years ago

#482 closed defect (invalid)

ForeignKey inline editing drops records in the Admin application

Reported by: brovienas@… Owned by: Adrian Holovaty
Component: Core (Cache system) Version:
Severity: normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


I am using the ForeignKey with inline editing.

  1. I have opened the admin editor tp modify an existing parent record
  2. I have added an entry to child record
  3. Saved
  4. Go to edit the parent record
  5. I now have 2 places to enter the data. The first one is populated with previous data. The second one is empty.
  6. I click save
  7. I get the exception as displayed below
  8. 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:        
    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/", line 64, in get_response
    response = callback(request, **param_dict)

  File "/usr/lib/python2.3/site-packages/django/views/admin/", line 878, in change_stage
    new_object =

  File "/usr/lib/python2.3/site-packages/django/utils/", 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/", line 1549, in manipulator_save

  File "/usr/lib/python2.3/site-packages/django/utils/", 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/", line 801, in method_save
    ','.join(field_names), ','.join(placeholders)), db_values)

  File "/usr/lib/python2.3/site-packages/django/core/db/", line 10, in execute
    result = self.cursor.execute(sql, params)

  File "/usr/lib/python2.3/site-packages/MySQLdb/", line 137, in execute
    self.errorhandler(self, exc, value)

  File "/usr/lib/python2.3/site-packages/MySQLdb/", line 33, in defaulterrorhandler
    raise errorclass, errorvalue

OperationalError: (1048, "Column 'nuo' cannot be null")

Change History (2)

comment:1 Changed 14 years ago by Jacob

Resolution: invalid
Status: newclosed

From "It is an error to have an inline-editable relation without at least one core=True field."

(django-admin validate will also catch this error.)

comment:2 Changed 12 years ago by anonymous

Component: Admin interfaceCache system
Triage Stage: UnreviewedAccepted
Note: See TracTickets for help on using tickets.
Back to Top