Ticket #3098: m2mtablename_update_rev4415.patch

File m2mtablename_update_rev4415.patch, 1.9 KB (added by floguy@…, 17 years ago)

Updated this patch for SVN revision 4415.

  • django_src/django/db/models/fields/related.py

     
    629629            limit_choices_to=kwargs.pop('limit_choices_to', None),
    630630            raw_id_admin=kwargs.pop('raw_id_admin', False),
    631631            symmetrical=kwargs.pop('symmetrical', True))
     632        self.db_table = kwargs.pop('db_table', None)
    632633        if kwargs["rel"].raw_id_admin:
    633634            kwargs.setdefault("validator_list", []).append(self.isValidIDList)
    634635        Field.__init__(self, **kwargs)
     
    651652
    652653    def _get_m2m_db_table(self, opts):
    653654        "Function that can be curried to provide the m2m table name for this relation"
    654         return '%s_%s' % (opts.db_table, self.name)
     655        if self.db_table:
     656            return self.db_table
     657        else:
     658            return '%s_%s' % (opts.db_table, self.name)
    655659
    656660    def _get_m2m_column_name(self, related):
    657661        "Function that can be curried to provide the source column name for the m2m table"
  • django_src/docs/model-api.txt

     
    874874                             force Django to add the descriptor for the reverse
    875875                             relationship, allowing ``ManyToMany`` relationships to be
    876876                             non-symmetrical.
     877                             
     878    ``db_table``             The name of the table to create for storing the m2m data.
     879                             If this isn't given, Django will use ``app_label + '_' + table1 + '_' + table2``.
    877880
    878881    =======================  ============================================================
    879882
Back to Top