Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#27733 closed Bug (worksforme)

ClearableFileInput widget renders incorrectly

Reported by: Luca De Feo Owned by: nobody
Component: Forms Version: 1.10
Severity: Normal Keywords: forms widgets file input
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The forms.widgets.ClearableFileInput widget (used, e.g., by the admin app) renders as

<a href="<bound method FieldFile.url of <FieldFile: EXAMPLE>>">EXAMPLE</a>

with the href attribute obviously mis-generated.

Using Django 1.10. This line seems to be the culprit: https://github.com/django/django/blob/1.10.5/django/forms/widgets.py#L400

Change History (4)

comment:1 by Claude Paroz, 7 years ago

Resolution: needsinfo
Status: newclosed

FieldFile.url is a property, not a method, see https://github.com/django/django/blob/1.10.5/django/db/models/fields/files.py#L70

Are you using a third-party FieldFile class?

comment:2 by Luca De Feo, 7 years ago

You are totally right. I don't know how it had been working for so long before. Maybe it used to be a method before 1.10?

comment:3 by Claude Paroz, 7 years ago

Resolution: needsinfoworksforme

It has been a property for a long time (or always has), but as long as it used in templates only, it doesn't make a big difference. What might be new is its usage in Python code.

comment:4 by Luca De Feo, 7 years ago

I see. Thanks, and sorry for the noise.

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