Code

Opened 8 years ago

Closed 7 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: UI/UX:

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

Attachments (0)

Change History (1)

comment:1 Changed 7 years ago by Paul Bx <pb@…>

  • Resolution set to fixed
  • Status changed from new to closed

These appear to have been fixed at some point.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.