Opened 19 years ago
Closed 19 years ago
#766 closed enhancement (fixed)
[patch, new-admin] Allow html tags if "allow_tags" model's method attribute is present
Reported by: | plisk | Owned by: | rjwittams |
---|---|---|---|
Component: | contrib.admin | Version: | |
Severity: | minor | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Subj, to use like shown below. It allows to include html in object list. Patch against revision 1153, change is in function items_for_result.
class Policy(meta.Model): subject = meta.CharField(maxlength=100) date_added = meta.DateTimeField('Date Added', default=datetime.today()) def link_view(self): return '<a href="' + str(self.id) + '/view/' + '">view</a>' link_view.short_description = 'Action' link_view.allow_tags = True class META: admin = meta.Admin( list_display = ('subject', 'date_added', 'link_view'), )
Attachments (2)
Change History (8)
comment:1 by , 19 years ago
Description: | modified (diff) |
---|
by , 19 years ago
Attachment: | admin_list.patch added |
---|
comment:2 by , 19 years ago
Hm, not sure about applying this in new-admin (changes admin behaviour). I can see it could be useful.
Adrian, Jacob, any thoughts?
comment:3 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:4 by , 19 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Sorry to bother, but after revising the code i guess its written with potential exception catch missing. Seems like "func = getattr(result, field_name)" should be in try block and exception is AttributeError and not ObjectDoesNotExist ? Maybe i'm not right, but just want to be sure it will be always working correctly. Below is patch for this.
comment:5 by , 19 years ago
Applied exception fix to new-admin.
Should be applied in trunk if new-admin isn't merged soon....
Add support for allow_tags attribute