tickets: 3323
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3323 | 2007-01-18 19:06:43 | 2007-12-02 23:18:40 | 2022-03-06 03:28:24.650622 | Ready for checkin | closed | Database layer (models, ORM) | dev | fixed | Unhelpful error message in case of unresolved string relation ('str' object has no attribute '_meta') | imagine the following model: {{{ class Test(models.model): rel = models.ForeignKey("bleh") }}} if the relation is not resolvable, in case of a typo or if it's in a different file, the user gets a rather unhelpful exception: {{{ Unhandled exception in thread started by <function inner_run at 0x2af9aa4e9668> Traceback (most recent call last): File "/home/alex/source/svn/django/django/core/management.py", line 1108, in inner_run validate() File "/home/alex/source/svn/django/django/core/management.py", line 1070, in validate num_errors = get_validation_errors(outfile) File "/home/alex/source/svn/django/django/core/management.py", line 936, in get_validation_errors for r in rel_opts.get_all_related_objects(): File "/home/alex/source/svn/django/django/db/models/options.py", line 127, in get_all_related_objects if f.rel and self == f.rel.to._meta: AttributeError: 'str' object has no attribute '_meta' }}} a quick hacky fix is attached, but i guess it should be done in django.core.management.validate | nobody | alex@gc-web.de | sprintsept14 sprintdec01 | 0 | 1 | 0 | 0 | 0 | 0 |