Opened 20 years ago
Closed 20 years ago
#331 closed defect (fixed)
Unexpected model attributes crash install
| Reported by: | anonymous | Owned by: | Adrian Holovaty |
|---|---|---|---|
| Component: | Tools | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Attributes in the model class that django isn't expecting cause djangoadmin.py install <foo> to crash with a particularly nondescript error (AttributeError: '<whatever>' object has no attribute 'custom'). Functions and expected non-function attributes are all parsed correctly, but it appears that when django encounters an unknown name it doesn't do type-checking (in this case, it was a tuple used as a choices argument, which can't be assigned values using foo.bar).
Sample model:
class Sample(meta.Model):
FRAMEWORK_CHOICES = (
(0, "Django"),
(1, "RoR"),
(2, "Other"),
)
fields = (
meta.IntegerField('framework', choices=Sample.FRAMEWORK_CHOICES)
),
nb: The problem was fixed by moving it to the module rather than the class, but it can no longer be referenced by custom functions, as they are generated in a different module.
Change History (2)
comment:1 by , 20 years ago
| Component: | Admin interface → Tools |
|---|
comment:2 by , 20 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
I think this is fixed at this point.