Code

Opened 5 years ago

Closed 5 years ago

#10179 closed (duplicate)

admin broken on FileField with blank=True

Reported by: malte Owned by: nobody
Component: Core (Management commands) Version: 1.0
Severity: Keywords: admin filefield bug
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description (last modified by ramiro)

If you have a FileField declared like so:

image_1 = models.FileField(upload_to=get_image_path, null=True, blank=True)

Then in django admin, the field becomes voluntary as it should. If you save a file in an optional field that works as expected. But if you come back to the item in the admin, and just hit 'save' without touching the optional file that is uploaded, the db record gets updated with a blank value for the FileField, effectively killing the connection with the file.

I'm using Sqlite, may make a difference here I suppose.

Attachments (0)

Change History (6)

comment:1 Changed 5 years ago by Alex

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

I'm guessing this is a consequence of the file assignment stuff from a week or two ago.

comment:2 follow-up: Changed 5 years ago by ramiro

  • Description modified (diff)

(reformatted description)

malte: What version of Django are you using? If youa re using a revision from trunk latter that r9766, can you please try with r9765 and report back?

comment:3 in reply to: ↑ 2 ; follow-up: Changed 5 years ago by erwinelling@…

Replying to ramiro:

(reformatted description)

malte: What version of Django are you using? If youa re using a revision from trunk latter that r9766, can you please try with r9765 and report back?

Ramiro: I can confirm that this problem does not exist in r9755 and starts appearing as of r9766.

(For others: A thread on this on Django Users Google Group can be found here http://groups.google.com/group/django-users/browse_thread/thread/b618845843bced67/8905992cb00ec0a1)

comment:4 in reply to: ↑ 3 Changed 5 years ago by erwinelling@…

Malte suggests that this might have something to do with using SQLite, but I came across this problem on PostgreSQL as well.

comment:5 Changed 5 years ago by anonymous

Yes, this problem starts in r9766. in 9765 it's OK

comment:6 Changed 5 years ago by kmtracey

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

Dup of #10121.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.