Opened 9 years ago

Closed 9 years ago

#11380 closed (invalid)

missed error description and line (and file) which contains it [TIP]

Reported by: pedromagnus Owned by: nobody
Component: Uncategorized Version: 1.0
Severity: Keywords: error, _meta, foreignkey
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


I had the following output for validating my aplication:

/var/lib/python-support/python2.6/MySQLdb/ DeprecationWarning: the sets module is deprecated
  from sets import ImmutableSet
Traceback (most recent call last):
  File "", line 11, in <module>
  File "/var/lib/python-support/python2.6/django/core/management/", line 340, in execute_manager
  File "/var/lib/python-support/python2.6/django/core/management/", line 295, in execute
  File "/var/lib/python-support/python2.6/django/core/management/", line 192, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/var/lib/python-support/python2.6/django/core/management/", line 219, in execute
    output = self.handle(*args, **options)
  File "/var/lib/python-support/python2.6/django/core/management/", line 348, in handle
    return self.handle_noargs(**options)
  File "/var/lib/python-support/python2.6/django/core/management/commands/", line 9, in handle_noargs
  File "/var/lib/python-support/python2.6/django/core/management/", line 246, in validate
    num_errors = get_validation_errors(s, app)
  File "/var/lib/python-support/python2.6/django/core/management/", line 95, in get_validation_errors
    for r in rel_opts.get_all_related_objects():
  File "/var/lib/python-support/python2.6/django/db/models/", line 338, in get_all_related_objects
  File "/var/lib/python-support/python2.6/django/db/models/", line 367, in _fill_related_objects_cache
    if f.rel and not isinstance(, str) and self ==
AttributeError: 'unicode' object has no attribute '_meta'

My app has several subapps and models, so there's no way I could locate the error with this output. By the way, someone knows why the validation is failing by? :P
Sorry for my bad english)

Change History (2)

comment:1 Changed 9 years ago by pedromagnus

Keywords: foreignkey added
Summary: missed error description and line (and file) which contains itmissed error description and line (and file) which contains it [TIP]

I finally found the origin of the error (with some help of a camarade).
The error was a ForeignKey declaration:

'''from myapp.practicas import Practica'''

# line with the error
practica = models.ForeignKey(u'Práctica', Practica)

# corrected line 
practica = models.ForeignKey(Practica, u'Práctica')

The docs say (and really clear) that a ForeignKey declaration MUST start with the class name (not with its alias). My mistake is had read the docs days after I wrote my app, so I forgot what I had written :P

The thing here is: the error is missed for the validation, and appears when it's too late to reach the error cause (I think). It has to point out this kind of errors, it's very tedious to dive in your code looking for 'something bad'.

I hope this could be helpfull to someone who's about to dive in the same way I did.


comment:2 Changed 9 years ago by Dennis Kaarsemaker

Resolution: invalid
Status: newclosed

Closing as invalid. USer error, not bug.

Note: See TracTickets for help on using tickets.
Back to Top