﻿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
4157	Add is_equal method to models for other kinds of equality checking.	Michael Axiak <axiak@…>	nobody	"There are many cases where one might want to check to see if two models are equal (and not just the same database row). If you take the OO analogy, you might want to see if two Articles are equivalent articles even if they are not the 'same' object.
This patch will allow one to do that. You can specify which fields you want to exclude by specifying attnames in the exclude parameter. If it's left unspecified, it will automatically exclude the primary key field(s). To disable excluding the primary key, just set ``excludes`` to ``[]``. 
Examples:

{{{
#!python
class Article(models.Model):
    subject = models.CharField(maxlength=512)
    submitted = models.DateTimeField()
    author  = models.ForeignKey(User)

# suppose a and b only differ on when they were submitted

a = Article.objects.get(id = 5)
b = Article.objects.get(id = 6)

a.is_equal(b)
False

a.is_equal(a)
True

a.is_equal(b, ['id','submitted'])
True

a.is_equal(b, [])
False

a.is_equal(a, [])
True
}}}
"		closed	Database layer (models, ORM)	dev		wontfix	equality,models	Michael Axiak <axiak@…> ferringb@…	Design decision needed	1	1	1	0	0	0
