简体   繁体   中英

Django 3 delete field items via Admin panel

I have a Django app, in which i have a model of Candidate, and the candidate has a field Video - goes as file.

I do have the option to change the field, for example upload a new video, and it will replace it, but how can i delete a video of a candidate, and leave it empty?

currntly i have something like this in the admin panel:

Currently: uploads/VIDEOS/mediarecorder_11.mp4
Change: [Coose File] No file chosen

how can i just delete the video, and leave it empty?

as you can see in this image - https://ibb.co/FxsGRfq I don't get a 'clear' option or something..

Candidate class:

class Candidate(models.Model):

....
video = models.FileField(upload_to=f'uploads/VIDEOS', null=True, blank=True, validators=[video_size_validator],
                         editable=True)

cv = models.FileField(upload_to=f'uploads/CV', null=True, validators=[cv_size_validator])

...

There should be a clear option on the same line as currently, check it and save your object.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM