tickets: 8681
This data as json
id | created | changetime | last_pulled_from_trac | stage | status | component | type | severity | version | resolution | summary | description | owner | reporter | keywords | easy | has_patch | needs_better_patch | needs_tests | needs_docs | ui_ux |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8681 | 2008-08-29 12:34:35 | 2009-02-25 20:58:46 | 2022-03-06 03:42:53.790898 | Unreviewed | closed | Core (Other) | dev | invalid | Uncaught exception in django/db/models/base.py: UnboundLocalError | In source:django/trunk/django/db/models/base.py as of [8696], lines 197-203: {{{ #!python for field in fields_iter: rel_obj = None if kwargs: if isinstance(field.rel, ManyToOneRel): try: # Assume object instance was passed in. rel_obj = kwargs.pop(field.name) }}} If kwargs[field.name] is None, rel_obj is set to None, val is not set at all, and we get an UnboundLocalError at line 226. Context: the model in question had a OneToOneField whose primary_key was not yet set/was set to None and a save() was attempted. See stacktrace at dpaste: http://dpaste.com/74655/ Either we need to have a better error-message here, for instance mentioning what field is the problem and how it can be fixed, or the code needs to do something sensible. | nobody | HM <hanne.moa@gmail.com> | models, onetoonefield | 0 | 0 | 0 | 0 | 0 | 0 |