31 lines
1.2 KiB
Diff
31 lines
1.2 KiB
Diff
# django__django-13401
|
|
# Loki Mode Multi-Agent Patch
|
|
# Attempts: 1
|
|
|
|
--- a/django/db/models/fields/__init__.py
|
|
+++ b/django/db/models/fields/__init__.py
|
|
@@ -516,13 +516,21 @@ class Field(RegisterLookupMixin):
|
|
def __eq__(self, other):
|
|
# Needed for @total_ordering
|
|
if isinstance(other, Field):
|
|
- return self.creation_counter == other.creation_counter
|
|
+ return (
|
|
+ self.creation_counter == other.creation_counter and
|
|
+ self.model == other.model
|
|
+ )
|
|
return NotImplemented
|
|
|
|
def __lt__(self, other):
|
|
# This is needed because bisect does not take a comparison function.
|
|
if isinstance(other, Field):
|
|
- return self.creation_counter < other.creation_counter
|
|
+ if self.creation_counter != other.creation_counter:
|
|
+ return self.creation_counter < other.creation_counter
|
|
+ elif self.model is not None and other.model is not None:
|
|
+ return self.model._meta.label < other.model._meta.label
|
|
+ return False
|
|
return NotImplemented
|
|
|
|
def __hash__(self):
|
|
- return hash(self.creation_counter)
|
|
+ return hash((self.creation_counter, self.model))
|