Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#25248 closed New feature (invalid)

Incorrect readonly_fields representation for some fields

Reported by: Mikhail Owned by: nobody
Component: contrib.admin Version: master
Severity: Normal Keywords:
Cc: vmspike@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Values of fields in readonly_fields in most cases shown as raw values.
I suppose it's incorrect for some fields.

I expected the following behavior:

  • CharField with 'choices' attribute should be shown as choice description instead of raw DB value;
  • date/time fields should be shown localized (tz, country format);
  • FileField should be shown as the link to file (if possible) (related to #14497 [closed, fixed], but I still see plain text with relative file path);
  • FilePath - the same as FileField (if possible: only if file can be downloaded);
  • ImageField should be shown as image or at link to image file like in FileField;
  • ManyToMany should be shown as list of objects str instead of 'app.model.None' string.

Am I right or current behavior is a feature? :)

Change History (2)

comment:1 Changed 4 years ago by Simon Charette

Triage Stage: UnreviewedAccepted
Version: 1.8master

It makes sense, patches welcome.

comment:2 Changed 4 years ago by Mikhail

Resolution: invalid
Status: newclosed

Sorry for premature ticket creation, seems all is fine on django side.

Firstly it was error in django-money side when it's incorrectly override django.contrib.admin.utils.AdminReadonlyField.contents() method in djmoney/__init__.py (seems it was old version of the method historically remains).
Secondly I'm using incorrect translation some real fields to virtual.

Django's display_for_field() do their job fine.

Last edited 4 years ago by Mikhail (previous) (diff)
Note: See TracTickets for help on using tickets.
Back to Top