Opened 6 years ago

Closed 6 years ago

#12245 closed (fixed)

m2m-refactor: r11724 broke model definitions outside of a "models" module (e.g. in tests)

Reported by: emulbreh Owned by: nobody
Component: Uncategorized Version: 1.1
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation:
Needs tests: Patch needs improvement:
Easy pickings: UI/UX:

Description

While not documented, it was possible to declare a model in tests.py (by explicitly setting app_label).

Since r11724 create_many_to_many_intermediary_model() assumes a module called models. This breaks test models that contain m2m fields. And thus requires a solution (or workaround) for #7835.

I'd suggest setting app_label for auto created models instead of scanning the module name.

Attachments (1)

12245.m2m_intermediary_app_label.diff (1.2 KB) - added by emulbreh 6 years ago.

Download all attachments as: .zip

Change History (2)

Changed 6 years ago by emulbreh

comment:1 Changed 6 years ago by russellm

  • Resolution set to fixed
  • Status changed from new to closed

(In [11755]) Fixed #12245 -- Corrected target app handling for auto-generated m2m models when the parent model isn't in the models module (or a subpackage thereof). Thanks to emulbreh for the report and patch.

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