Add is_equal method to models for other kinds of equality checking.
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
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)
Change History (8)
Design decision needed
Michael Axiak <axiak@…> ferringb@… added; Michael Axiak <axiak@…> removed