Opened 19 years ago

Closed 17 years ago

#1388 closed defect (fixed)

[magic-removal] [patch] Old-style DB API fixes (manipulators, generic views)

Reported by: russell@… Owned by: Jacob
Component: Generic views Version: magic-removal
Severity: normal Keywords:
Cc: Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hi,

Some misc fixes in magic-removal for some old-style DB API usage that is still present:

--- magic-removal/django/views/generic/create_update.py.orig    2006-02-23 10:36:34.000000000 +0200
+++ magic-removal/django/views/generic/create_update.py 2006-02-23 10:33:13.000000000 +0200
@@ -96,7 +96,7 @@
         raise AttributeError("Generic edit view must be called with either an object_id or a slug/ slug_field")
     lookup_kwargs.update(extra_lookup_kwargs)
     try:
-        object = model._default_manager.get_object(**lookup_kwargs)
+        object = model._default_manager.model.objects.get(**lookup_kwargs)
     except ObjectDoesNotExist:
         raise Http404, "No %s found for %s" % (model._meta.verbose_name, lookup_kwargs)

--- magic-removal/django/db/models/manipulators.py~     2006-02-23 10:42:43.000000000 +0200
+++ magic-removal/django/db/models/manipulators.py      2006-02-23 10:42:43.000000000 +0200
@@ -120,7 +120,7 @@
                         new_vals = new_data.get(f.name, ())
                     else:
                         new_vals = new_data.getlist(f.name)
-                    was_changed = getattr(new_object, 'set_%s' % f.name)(new_vals)
+                    was_changed = getattr(new_object, '%s' % f.name).add(new_vals)
                     if self.change and was_changed:
                         self.fields_changed.append(f.verbose_name)

Russell

Change History (1)

comment:1 by Paul Bx <pb@…>, 17 years ago

Resolution: fixed
Status: newclosed

These appear to have been fixed at some point.

Note: See TracTickets for help on using tickets.
Back to Top