#1313 closed defect (fixed)
[patch] removed use of klass from admin/models.py and get_object from db/models/fields/__init__.py
Reported by: | jpaulofarias at gmail dot com | Owned by: | Adrian Holovaty |
---|---|---|---|
Component: | contrib.admin | Version: | magic-removal |
Severity: | normal | Keywords: | admin, db |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Removed those two usages and replaced klass with model and get_object with get.
Index: django/contrib/admin/models.py =================================================================== --- django/contrib/admin/models.py (revision 2216) +++ django/contrib/admin/models.py (working copy) @@ -9,7 +9,7 @@ class LogEntryManager(models.Manager): def log_action(self, user_id, content_type_id, object_id, object_repr, action_flag, change_message=''): - e = self.klass(None, None, user_id, content_type_id, object_id, object_repr[:200], action_flag, change_message) + e = self.model(None, None, user_id, content_type_id, object_id, object_repr[:200], action_flag, change_message) e.save() class LogEntry(models.Model): Index: django/db/models/fields/__init__.py =================================================================== --- django/db/models/fields/__init__.py (revision 2216) +++ django/db/models/fields/__init__.py (working copy) @@ -32,7 +32,7 @@ "Validates that the value is unique for this field." lookup_type = f.get_validator_unique_lookup_type() try: - old_obj = self.manager.get_object(**{lookup_type: field_data}) + old_obj = self.manager.get(**{lookup_type: field_data}) except ObjectDoesNotExist: return if getattr(self, 'original_object', None) and self.original_object._get_pk_val() == old_obj._get_pk_val():
Note:
See TracTickets
for help on using tickets.
(In [2218]) magic-removal: Fixed #1313 -- Bugfixes for magic-removal. Thanks, jpaulofarias