Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#16790 closed Bug (fixed)

GeoDjango tutorial error (selecting WorldBorders via admin crashes)

Reported by: jdiego Owned by: jdiego
Component: GIS Version: master
Severity: Normal Keywords: GIS GeoDjango tutorial
Cc: john@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


First time django contributor; I may be doing something wrong, but here it goes...

Note that the crash does not occur with the 1.3.0 release (I'm running trunk, 1.4.0 alpha).

Got to the following point in the tutorial: "Finally, browse to http://localhost:8000/admin/, and log in with the admin user created after running syncdb. Browse to any of the WorldBorders entries"

Clicking on "WorldBorders" causes the crash: "'super' object has no attribute '_media'"

The following seems to be the problem:
the first thing that django.contrib.gis.admin.options.GeoModelAdmin._media()
does is to invoke...

media = super(GeoModelAdmin, self)._media()  

The problem is that there was a recent changeset (16594) in the parent class (ModelAdmin). In that changeset the following changed:


def _media(self): 


def media(self): 

I tested a patch (which I'll submit shortly) where GeoModelAdmin gets "media" from its parent as a property, instead of getting it via a method call. This seems to fix the problem.

media = super(GeoModelAdmin, self).media

Note that I ran the GeoDjangoTestSuiteRunner tests and although there were some errors, none of them seem to correspond to this case; however, I'm not positive about this.

Attachments (2)

16790.1.diff (702 bytes) - added by jbronn 7 years ago.
16790.2.diff (2.6 KB) - added by jbronn 7 years ago.
Added test stub.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 7 years ago by jdiego

Owner: changed from nobody to jdiego
Status: newassigned

comment:2 Changed 7 years ago by John Paulett

Cc: john@… added
Triage Stage: UnreviewedAccepted

Changed 7 years ago by jbronn

Attachment: 16790.1.diff added

Changed 7 years ago by jbronn

Attachment: 16790.2.diff added

Added test stub.

comment:3 Changed 7 years ago by jbronn

Resolution: fixed
Status: assignedclosed

In [16775]:

Fixed #16790 -- Modified the geographic admin to work after r16594. Thanks, jdiego, for the bug report and patch.

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