Opened 11 years ago

Closed 11 years ago

Last modified 10 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: UI/UX:

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 11 years ago.
Use 'model' arg instead of 'module_name' for generic views

Download all attachments as: .zip

Change History (9)

comment:1 Changed 11 years ago by Esaj

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

comment:2 Changed 11 years ago by Esaj

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

comment:3 Changed 11 years ago by Esaj

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 Changed 11 years ago by Adrian Holovaty

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 Changed 11 years ago by Esaj

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.

Changed 11 years ago by Esaj

Attachment: generic.diff added

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

comment:6 Changed 11 years ago by anonymous

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

comment:7 Changed 11 years ago by Esaj

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 Changed 11 years ago by Adrian Holovaty

Resolution: fixed
Status: newclosed

Fixed in [1933].

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