﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
17299	The proxy model does not allow one to use ManyToMany fields	anonymous	nobody	"Suppose I have an app where the users may write messages. Then suppose that users must be able to follow one another in a twitter-like fashion. As far as I see, the most clean solution will be to create a non-symmetrical self-referencing m2m relation on the contrib.auth.models.User. Editing the code in contrib.auth.models.User itself will be naturally be an outrage, so I'll need to define a model inheriting from User and define the m2m relation there but this will lead to the creation of a new DB table for the descendant which will contain only the id field. In order to avoid this, one would suppose that he should be able to define the descendant as a proxy model, as the new m2m relation doesn't really affect the database representation of contrib.auth.User besides creating foreign keys to the intermediary model.

Unfortunately, the following code will result in ""django.core.exceptions.FieldError: Proxy model 'MyUser' contains model fields"":


{{{
from django.contrib.auth import models

class MyUser(models.User):
    subscription = models.ManyToMany('self', symmetrical=False)

    class Meta:
        proxy = True
}}}
"	Bug	closed	Database layer (models, ORM)	1.3	Normal	invalid			Unreviewed	0	0	0	0	0	0
