Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#1085 closed defect (fixed)

[patch] Make generic views work with magic-removal models

Reported by: Esaj Owned by: adrian
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 9 years ago.
Use 'model' arg instead of 'module_name' for generic views

Download all attachments as: .zip

Change History (9)

comment:1 Changed 9 years ago by Esaj

  • Summary changed from 'module' object has no attribute 'get_module' to [magic-removal] AttributeError: 'module' object has no attribute 'get_module'

comment:2 Changed 9 years ago by Esaj

  • Component changed from Generic views to Database wrapper
  • Owner changed from jacob to adrian

comment:3 Changed 9 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 9 years ago by adrian

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

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

comment:6 Changed 9 years ago by anonymous

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

comment:7 Changed 9 years ago by Esaj

  • Summary changed from [patch] [magic-removal] AttributeError: 'module' object has no attribute 'get_module' to [patch] Make generic views work with magic-removal models
  • Version set to magic-removal

comment:8 Changed 9 years ago by adrian

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in [1933].

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