Opened 18 years ago

Closed 18 years ago

#3098 closed enhancement (fixed)

[patch] rename m2m table

Reported by: wolfram.kriesing@… Owned by: Russell Keith-Magee
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: no UI/UX: no

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@… 18 years ago.
m2mtablename-doc.diff (649 bytes ) - added by wolfram.kriesing@… 18 years ago.
m2mtablename_update_rev4415.patch (1.9 KB ) - added by floguy@… 18 years ago.
Updated this patch for SVN revision 4415.
models.py (2.4 KB ) - added by floguy@… 18 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)

by wolfram.kriesing@…, 18 years ago

Attachment: m2mtabelname.patch added

comment:1 by Russell Keith-Magee, 18 years ago

Type: defectenhancement

Good idea - needs documentation and a test case.

comment:2 by Russell Keith-Magee, 18 years ago

Cc: freakboy@… added
Owner: changed from Adrian Holovaty to Russell Keith-Magee
Status: newassigned

by wolfram.kriesing@…, 18 years ago

Attachment: m2mtablename-doc.diff added

comment:3 by Simon G. <dev@…>, 18 years ago

Keywords: m2m added
Needs documentation: set
Needs tests: set
Triage Stage: UnreviewedAccepted

by floguy@…, 18 years ago

Updated this patch for SVN revision 4415.

by floguy@…, 18 years ago

Attachment: models.py added

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

comment:4 by floguy@…, 18 years ago

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 by Simon G. <dev@…>, 18 years ago

Triage Stage: AcceptedReady 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 by Russell Keith-Magee, 18 years ago

Resolution: fixed
Status: assignedclosed

(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