#1085 closed defect (fixed)
[patch] Make generic views work with magic-removal models
| Reported by: | Esaj | Owned by: | Adrian Holovaty |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | magic-removal |
| Severity: | normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
AttributeError: 'module' object has no attribute 'get_module'
Exception Location: /usr/lib/python2.3/site-packages/django/views/generic/list_detail.py in object_list, line 37
models.get_module(app, module_name) appears to be commented out in django/db/models/__init__.py
Attachments (1)
Change History (9)
comment:1 by , 20 years ago
| Summary: | 'module' object has no attribute 'get_module' → [magic-removal] AttributeError: 'module' object has no attribute 'get_module' |
|---|
comment:2 by , 20 years ago
| Component: | Generic views → Database wrapper |
|---|---|
| Owner: | changed from to |
comment:3 by , 20 years ago
comment:4 by , 20 years ago
Hmmm, we should remove the <app_label>/<module_name> thing as well, because there's no longer a concept of "module_name" in magic-removal. What do you think would be a good template-directory naming convention?
comment:5 by , 20 years ago
We could keep app_label and just use the lowercase version of the model class name instead of module_name. In case of namespace clashes, perhaps we should have an optional template_prefix arg which would override the lowercase classname and give us <app_label>/<template_prefix>_xxx.
An alternative would be to try and use the full path of the model class name (replacing . with /) but that would get a bit long and unwieldy, although it might reduce the chance of namespace clashes.
by , 20 years ago
| Attachment: | generic.diff added |
|---|
Use 'model' arg instead of 'module_name' for generic views
comment:6 by , 20 years ago
| Summary: | [magic-removal] AttributeError: 'module' object has no attribute 'get_module' → [patch] [magic-removal] AttributeError: 'module' object has no attribute 'get_module' |
|---|
comment:7 by , 20 years ago
| Summary: | [patch] [magic-removal] AttributeError: 'module' object has no attribute 'get_module' → [patch] Make generic views work with magic-removal models |
|---|---|
| Version: | → magic-removal |
Looks like the generic views need to be modified to use a
modelarg for specifying which model class to use. Presumablyapp_labelandmodule_nameneed to be kept for selecting the template using<app_label>/<module_name>.