Python Django bulk upload file and bind the description of the corresponding file

Source: Internet
Author: User

Modify the request. Post.get () is request. Post.getlist () results as in the blue horizontal bar below, fully meet the requirements of the project

The background database has only one field stored for the picture, and it is not possible to have as many fields as the number of photos. Other words

1: One can only be stored in the background to the database at a time.

2: In front of the show, you can directly cycle this field to show my picture

So this involves a list (a dictionary) with the data that is stored in the loop.

The dictionary is used because each of my pictures also has its own picture description, both of which are submitted and saved at the same time.

Make a list of the URL that you saved with the picture, and then save it in a loop.

The main use of this is the Python zip () function

>>> s=[' A ', ' B ']
>>> b=[' 1 ', ' 2 ']
>>> Zip (s,b)
[(' A ', ' 1 '), (' B ', ' 2 ')]

Python Django bulk upload file and bind the description of the corresponding file

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.