is appropriate to compare User and UserProxy as equal. To not treat
it to a User object. If you need to in your own code, you can always
> Speaking on a semantic level, a "proxy" is a stand-in acting on behalf
> of (or in place of) another entity. There is an implied near-
> equivalence, but inherent in the idea of a proxy is that it is *not*
> the same as the original. As in the case of assigning a proxy to vote
> for you in corporate elections: the proxy you delegate your right to
> vote to is the functional equivalent of you, but they are recognized
> as not *actually* being you.
> In my mind the same reasoning applies to Proxy Models. While they are
> a stand-in for accessing the same underlying data, they may have very
> different properties (ordering, methods, etc.). So while they may pass
> a rough equivalence test, they are in specific ways dissimilar. The
> underlying table/data stored by the model is only one piece of what
> makes up the sum total of a model.
> That said, I can certainly see the use case for comparing proxy models
> as equal to the original model...
> All the best,
> - Gabriel
> On Oct 20, 6:24 am, Byron <bjr...@gmail.com> wrote:
> > Continuing from...http://code.djangoproject.com/ticket/14492
> > > the real issue here is "What is a Proxy", and "what is equality"
> > I agree, that is the real issue. I based most of my reasoning off of
> > what the docs already state in that a proxy model can be written to
> > extend the behavior of the model being proxied, i.e. the data model
> > cannot be changed. That being said, I feel the default behavior when
> > dealing with equality, other data related things... should inherit
> > from there parent. If there is a need to override this behavior, I am
> > sure other hooks can be implemented to customize proxy models
> > differently then there parent. With regards to my primary issue of
> > equality, in this context two objects are being compared to determine
> > whether they represent the same row of data. It seems less likely to
> > compare two model objects to only be interested in whether they are
> > equal data structures.
> > Regarding permissions, the arguments presented inhttp://code.djangoproject.com/ticket/11154
> > all can be accomplished with writing a custom manager for the proxy
> > model or writing a custom ModelAdmin class for the admin. I agree with
> > Malcolm that a proxy model's permission should shadow its parent.
> > On Oct 19, 9:08 am, Byron <bjr...@gmail.com> wrote:
> > > Added ticket and patch:http://code.djangoproject.com/ticket/14492
> > > On Oct 17, 12:00 pm, Byron <bjr...@gmail.com> wrote:
> > > > I came across an issue when comparing a model proxy instance and a
> > > > model instance, that is:
> > > > obj1 = Entry.objects.get(id=1)
> > > > obj2 = EntryProxy.objects.get(id=1)
> > > > obj1 == obj2 # False
> > > > This I feel is a bug and the culprit is in ``Model.__eq__`` where it
> > > > tests to see if the object being compared against is an instance of
> > > > the same class of the Model itself.. which will always be false for
> > > > proxy models being compared to there non-proxied instance
> > > > counterparts. It should test if it is a proxy and whether the object
> > > > is an instance of the parent class as well.
> > > > Was this a design decision or overlooked?