Opened 8 years ago

Closed 8 years ago

#3098 closed enhancement (fixed)

[patch] rename m2m table

Reported by: wolfram.kriesing@… Owned by: russellm
Component: Database layer (models, ORM) Version:
Severity: normal Keywords: m2m
Cc: freakboy@…, floguy@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

because i used a legacy app i needed to rename my m2m tables, this tiny patch allows the parameter db_table for ManyToManyField()
i.e. pics = models.ManyToManyField(Pic, db_table='core_pic2subchapter')

Attachments (4)

m2mtabelname.patch (1.1 KB) - added by wolfram.kriesing@… 8 years ago.
m2mtablename-doc.diff (649 bytes) - added by wolfram.kriesing@… 8 years ago.
m2mtablename_update_rev4415.patch (1.9 KB) - added by floguy@… 8 years ago.
Updated this patch for SVN revision 4415.
models.py (2.4 KB) - added by floguy@… 8 years ago.
Unit tests for this patch. To be placed in tests/modeltests/custom_tables/ along with an empty init.py

Download all attachments as: .zip

Change History (10)

Changed 8 years ago by wolfram.kriesing@…

comment:1 Changed 8 years ago by russellm

  • Type changed from defect to enhancement

Good idea - needs documentation and a test case.

comment:2 Changed 8 years ago by russellm

  • Cc freakboy@… added
  • Owner changed from adrian to russellm
  • Status changed from new to assigned

Changed 8 years ago by wolfram.kriesing@…

comment:3 Changed 8 years ago by Simon G. <dev@…>

  • Keywords m2m added
  • Needs documentation set
  • Needs tests set
  • Triage Stage changed from Unreviewed to Accepted

Changed 8 years ago by floguy@…

Updated this patch for SVN revision 4415.

Changed 8 years ago by floguy@…

Unit tests for this patch. To be placed in tests/modeltests/custom_tables/ along with an empty init.py

comment:4 Changed 8 years ago by floguy@…

  • Cc floguy@… added
  • Needs documentation unset
  • Needs tests unset

I have made the necessary changes to bring this patch up to date with revision 4415, and have created unit tests. I think that the tests fit best in a new folder under tests/modeltests/ called custom_tables. Also, I'm not quite sure why this was flagged as needs_docs, but it must have just gotten looked over that it already had docs attached on the 18th of December. Hopefully now it'll be ready for inclusion onto the trunk!

comment:5 Changed 8 years ago by Simon G. <dev@…>

  • Triage Stage changed from Accepted to Ready for checkin

Taking RussellM's comment above as a "yes" on design-decision-needed, I've moved this onto ready-for-checkin.

Thanks!

comment:6 Changed 8 years ago by russellm

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

(In [4429]) Fixed #3098 -- Added db_table parameter to m2m fields, allowing the specification of a custom table name for the m2m table. Thanks, Wolfram Kriesing.

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