Opened 18 years ago

Closed 17 years ago

#1821 closed defect (wontfix)

[patch] use module level attribute app_label for models. Support interactive use with minimal effort.

Reported by: mir@… Owned by: Adrian Holovaty
Component: Database layer (models, ORM) Version: dev
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

I'm really annoyed that you cannot use models interactively, or pychecker you model. To circumvent this restriction, I propose to add a module level attribute for model modules, such as

app_label = "applabel"

The attached patch also creates a more friendly error message in the case of interactive use instead of IndexError. It now says:

"""Interactive model use not directly supported.
To circumvent this restriction, add an app_label attribute to each model class or to
the model module."""

This might not be the ideal solution, but is an easy one and really helps.

Attachments (1)

app_label.diff (1.2 KB ) - added by mir@… 18 years ago.
patch

Download all attachments as: .zip

Change History (6)

by mir@…, 18 years ago

Attachment: app_label.diff added

patch

comment:1 by mir@…, 18 years ago

Summary: use module level attribute app_label for models. Support interactive use with minimal effort.[patch] use module level attribute app_label for models. Support interactive use with minimal effort.

comment:2 by Adrian Holovaty, 18 years ago

Status: newassigned

comment:3 by Home, 18 years ago

Type: enhancement

comment:4 by mir@…, 18 years ago

Type: defect

Beware, this patch is now making problems with syncdb. syncdb does not recognize the label if you use app_label.

On the other side, I think the improved error message would be received well.

comment:5 by anonymous, 17 years ago

Resolution: wontfix
Status: assignedclosed

I retract this because of the problems I stated.

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