Modify ↓
Ticket #788 (closed defect: wontfix)
pydev in Eclipse doesn't recognise DatabaseOperations
| Reported by: | mrpfisher@… | Owned by: | andrew |
|---|---|---|---|
| Priority: | minor | Milestone: | 1.0 |
| Component: | commands | Version: | 0.7.3 |
| Keywords: | Cc: |
Description
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]
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

I'm afraid that I'm not going to commit a fix purely for the benefit of pydev's linter/introspector - it sets a bad precedent.