What steps will reproduce the problem?
1. Create a model with a choice property, using a set as per the GAE docs:
class Person(db.Model):
name = db.StringProperty(required=True)
gender = db.StringProperty(choices=set(["male", "female"]))
2. Register the model with the admin site:
class PersonAdmin(admin.ModelAdmin):
list_display = ('name', 'gender')
admin.site.register(Person, PersonAdmin)
3. Log in to the admin site and attempt to administer the model; it will
raise an error in the patch code.
This is happening on OSX, patch version 1.1RC
It looks to me like there's a problem on line 180 of patch.py.
Naked choices is not in scope, and self.choices is not iterable, when using
GAE model.
It works when patched as follows:
@@ -177,7 +177,7 @@
"""Flattened version of choices tuple."""
if not self.choices:
return []
- if not isinstance(choices[0], (list, tuple)):
+ if not isinstance(self.choices, (list, tuple)):
return [(choice, choice) for choice in self.choices]
flat = []
for choice, value in self.choices:
Original issue reported on code.google.com by hux...@gmail.com on 2 Sep 2009 at 1:08
Original issue reported on code.google.com by
hux...@gmail.com
on 2 Sep 2009 at 1:08