Ticket #788 (closed defect: wontfix)
pydev in Eclipse doesn't recognise DatabaseOperations
|Reported by:||mrpfisher@…||Owned by:||andrew|
pydev complains "Undefined variable from import" for db.create_table, db.send_create_signal, etc in migration files.
The issue is described here on Stack Overflow.
This is the proposed patch for south/db/__init__.py submitted by SmileyChris?.
--- db/__init__.py.original 2010-12-02 03:00:26.000000000 +1300 +++ db/__init__.py 2011-05-02 14:07:19.353636710 +1200 @@ -72,5 +72,9 @@ ) sys.exit(1) -# Finally, to make old migrations work, keep 'db' around as the default database +# Finally, to make old migrations work, keep 'db' around as the default +# database. We're setting it explicitly to the generic operations first to +# avoid pydev errors. +from south.db import generic +db = generic.DatabaseOperations(DEFAULT_DB_ALIAS) db = dbs[DEFAULT_DB_ALIAS]