Code

Opened 7 years ago

Closed 7 years ago

#3522 closed (duplicate)

[newforms-admin] global name '_get_deleted_objects' is not defined

Reported by: rpercy@… Owned by: nobody
Component: contrib.admin Version: master
Severity: Keywords: newforms-admin _get_deleted_objects
Cc: Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Under the newforms-admin branch, deleting an object through the admin results in the following error:

Request Method: GET
Request URL: http://djangotest/admin/sandbox/book/2/delete/
Exception Type: NameError
Exception Value: global name '_get_deleted_objects' is not defined
Exception Location: /usr/lib/python2.4/site-packages/django/contrib/admin/options.py in delete_view, line 466

models.py:
from django.db import models

# Create your models here.
class Book(models.Model):    
    name = models.CharField(maxlength=100)
    
    class Admin:
        pass

Attachments (2)

deleted_objects_fix.diff (562 bytes) - added by philippe.raoult@… 7 years ago.
deleted_objects_fix2.diff (12.5 KB) - added by Glin <glin@…> 7 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 Changed 7 years ago by anonymous

  • Keywords _get_deleted_objects added; _get_deleted_objects' removed
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 7 years ago by Gary Wilson <gary.wilson@…>

  • Triage Stage changed from Unreviewed to Accepted

Changed 7 years ago by philippe.raoult@…

comment:3 Changed 7 years ago by philippe.raoult@…

  • Has patch set

The attached patch fixes the bug. It's against the newforms-admin branch.

comment:4 Changed 7 years ago by Simon G. <dev@…>

  • Triage Stage changed from Accepted to Ready for checkin

comment:5 Changed 7 years ago by mtredinnick

  • Summary changed from newforms-admin: global name '_get_deleted_objects' is not defined to [newforms-admin] global name '_get_deleted_objects' is not defined

Fixing title so that searches are easier.

comment:6 Changed 7 years ago by mtredinnick

  • Triage Stage changed from Ready for checkin to Design decision needed

Since the whole _get_deleted_objects() function is only for internal use and is only called by itself and the admin delete view, it's probably better to move the whole function into the place where it's used.

I'm not going to apply this one for the time being. Adrian can decide how he wants to break up the code.

Changed 7 years ago by Glin <glin@…>

comment:7 Changed 7 years ago by Glin <glin@…>

Well, first patch don't work anymore (because circular dependencies), so the only left option is to move whole _get_deleted_objects() function into the place where it's used. I attached patch, which do that.

Please try to fix this asap, because whole delete view don't work because of this.

comment:8 Changed 7 years ago by Glin <glin@…>

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

This was solved in #4524.

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.