ManyToMany db_column

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
from django.db import models

class ManyToManyField(models.ManyToManyField):
    def __init__(self, *args, **kwargs):
        source = kwargs.pop('source_db_column', None)
        reverse = kwargs.pop('reverse_db_column', None)
        if source is not None:
            self._m2m_column_name_cache = source
        if reverse is not None:
            self._m2m_reverse_name_cache = reverse
        super(ManyToManyField, self).__init__(*args, **kwargs)

Comments

powerfox (on January 15, 2009):

Nice, thanks.

#

(Forgotten your password?)

You may use Markdown syntax here, but raw HTML will be removed.