tickets: 4212
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4212 | 2007-05-04 00:56:43 | 2011-06-09 20:27:40 | 2022-03-06 03:30:47.864359 | Accepted | closed | Database layer (models, ORM) | Bug | Normal | dev | invalid | badly-defined ForeignKey to self does not cause an exception | I have a model something like this: {{{ class MyModel(models.Model): my_model = ForeignKey('MyModel') }}} This mostly works, but I was confused when I found that instances didn't have a my_model_set attribute. I found that I should've defined my model like this: {{{ class MyModel(models.Model): my_model = ForeignKey('self') }}} I can do that just fine, of course, but it was a bit non-obvious what the problem was. It'd be nice if defining that relationship improperly threw an exception. | ojii | Forest Bond <forest@alittletooquiet.net> | 0 | 0 | 0 | 0 | 0 | 0 |