Opened 12 years ago

Closed 12 years ago

#19069 closed Cleanup/optimization (fixed)

improve error when attempting to use a swapped model

Reported by: Preston Holmes Owned by: nobody
Component: Database layer (models, ORM) Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Currently two checks for a swapped model exist when creating a manager:

These result in an error:

AttributeError: type object 'User' has no attribute 'objects'

as opposed to DatabaseError: no such table: <...> which is the error when the model is swapped but has the default manager (as syncdb will not create tables for swapped models). Ideally - there should be a manager installed that just raises an error explaining that the model has been swapped and is unavailable and probably offer information about what model it was swapped for - as this is readily available.

Change History (1)

comment:1 by Russell Keith-Magee <russell@…>, 12 years ago

Resolution: fixed
Status: newclosed

In cc337a74f1808b216fff96f1695d8b066d2636f6:

Fixed #19069 -- Improved the error message when trying to query a swapped model.

Thanks to Preston Holmes for the suggestion.

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