Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#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)

generic.diff (22.4 KB ) - added by Esaj 18 years ago.
Use 'model' arg instead of 'module_name' for generic views

Download all attachments as: .zip

Change History (9)

comment:1 by Esaj, 18 years ago

Summary: 'module' object has no attribute 'get_module'[magic-removal] AttributeError: 'module' object has no attribute 'get_module'

comment:2 by Esaj, 18 years ago

Component: Generic viewsDatabase wrapper
Owner: changed from Jacob to Adrian Holovaty

comment:3 by Esaj, 18 years ago

Looks like the generic views need to be modified to use a model arg for specifying which model class to use. Presumably app_label and module_name need to be kept for selecting the template using <app_label>/<module_name>.

comment:4 by Adrian Holovaty, 18 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 Esaj, 18 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 Esaj, 18 years ago

Attachment: generic.diff added

Use 'model' arg instead of 'module_name' for generic views

comment:6 by anonymous, 18 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 Esaj, 18 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

comment:8 by Adrian Holovaty, 18 years ago

Resolution: fixed
Status: newclosed

Fixed in [1933].

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