Hi, and what's wrong with writing a fix for admin to make "inverted"
m2m relation to show m2m if specified in list_display list? I know
it's not easy to do for one who is not django creator, but since it's
open source... ;)

Core devs, what's your opinion?

Such change is pretty logical, short and non-intrusive.

On Thu, Jan 22, 2009 at 7:38 PM, Evgeniy Ivanov (powerfox)
<lolkaanti...@gmail.com> wrote:
>
> Reread what I've written and understand it would be much better with a
> sample:
>
> class User(models.Model):
>    groups = models.ManyToManyField('Group', related_name='groups',
> db_table=u'USERS_TO_GROUPS')
> class Group(models.Model):
>    users = models.ManyToManyField(User, related_name='users',
> db_table=u'USERS_TO_GROUPS')
>
> This code works fine with existing DB and also it really helps to
> generate proper form from the model. But syncdb fails since it tries
> to create 2 tables with the same name.
>
> class User(models.Model):
>    groups = models.ManyToManyField('Group', related_name='groups',
> db_table=u'USERS_TO_GROUPS')
> class Group(models.Model):
>    users = models.ManyToManyField(User, related_name='users',
> db_table=u'USERS_TO_GROUPS', create_table=False)
>
> Works fine.
>
> Also there was some discussion in django users:
> http://groups.google.com/group/django-users/browse_thread/thread/50bf564e98954a78
>
> On Jan 22, 12:38 am, "Evgeniy Ivanov (powerfox)"
> <lolkaanti...@gmail.com> wrote:
>> Hi list,
>> I had to implement M2M editing in both admin forms (something like
>> editing userlist for group and grouplist for user). I wasn't able to
>> find any fine solution, but specifying M2M in both models and creating
>> tables manually (since syncdb tries to create two tables).
>> I herd in the IRC, that such thing (editing in both forms) is
>> abnormal, but I disagree.
>> So I tried to use intermidiary model like described in the docs, but
>> it is really another thing (not "pure" m2m). Another solution is
>> hardcording the form, but it will require extra save code, I don't
>> like it too.
>>
>> I think that if you add special arg (create_table) to ManyToManyField
>> it can be easily implemented using models/fields/related.py:751.
>>
>> If you think it can go, I will create a ticket.
>>
>> Also there is (a kind of offtop) a very cute 
>> thing:http://www.djangosnippets.org/snippets/962/
>> Why isn't it in the native ManyToManyField?
> >
>



-- 
Best regards, Yuri V. Baburov, ICQ# 99934676, Skype: yuri.baburov,
MSN: bu...@live.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to