On 7/20/06, Geta <[EMAIL PROTECTED]> wrote:

I know you can
specify META.db_table to specify database table names and db_column for
field names, but I couldn't see where/if this could be set for a
ManyToManyField -- is it possible?

There isn't a simple way to do this - however, if you're feeling adventurous, there are a few things that might be worth trying.

The m2m table name is determined by the m2m_db_table() method on the ManyToManyField itself (from django.db.models.fields.related.py). Similarly, the m2m_column_name() and m2m_reverse_name() methods on the ManyToManyField determine the column names that are used on the m2m table. These three functions are curried versions of more generic functions (_get_m2m_db_table, et al). At present, they are hard coded to use the field and related model names as the basis for naming of the m2m table.

If you were to subclass ManyToManyField and override the _get_m2m versions of the functions, or modify the m2m_...() functions on a field instance, you might find that you can point the m2m relation at your existing table.

As a more general solution - your idea is reasonable enough, and shouldn't be too hard to implement. I would suggest submitting it as an enhancement request.

Yours,
Russ Magee %-)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to