开发者

How to pass the name of a file from one template to another template , both in different apps in django?

One of my apps is uploading a file . Now I want to add some more attributes with the model built from that file as a foreign key to this table . Let me describe flow a bit more .

  1. File A is uploaded by app1 开发者_Python百科
  2. app2 uses A's primary key as its foreign key , and creates new tables .

1st task is done . 2nd task is done by importing the model of File A .

My questions are these . 1. How to make the primary key of app1.model as the foreign key of app 2 . 2. In the template of app1 , when I click on the url that takes me to app2 template , how to pass the name of File A . So that I can display that I am doing changes related to File A on the template .

I hope I was clear .


View 1:

request.session['file_id'] = A.id

View 2:

file_id = request.session.get('file_id')
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜