开发者

Database: storing data from user registration form

Let's say I have an user registration form. In this form, I have the option for the user to upload a photo. I have an User table and Photo table. My User table has a "PathToPhoto" column. My question is how do I fill in the "PathToPhoto" column if the phot开发者_Go百科o is uploaded and inserted into Photo table before the user is created? Another way to phrase my question is how to get the newly uploaded photo to be associated to the user that may or may not be created next.

I'm using python and postgresql.


To make sure we're on the same page, is the following correct?

  • You're inserting the photo information into the Photo table immediately after the user uploads the photo but before he/she submits the form;
  • When the user submits the form, you're inserting a row into the User table;
  • One of the items in that row is information about the previously created photo entry.

If so, you should be able to store the "path to photo" information in a Python variable until the user submits the form, and then use the value from that variable in your User-table insert.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜