【发布时间】:2016-07-11 18:43:37
【问题描述】:
我对 Django 以及如何使用它来解决以下问题有一些疑问。 假设你有这两张桌子 产品表
---------------------------------------------------------------
| id | productName | description | id_country |
---------------------------------------------------------------
| 1 | x | fzefzzezfz | 1 |
---------------------------------------------------------------
| 2 | y | zoinojnfze | 1 |
---------------------------------------------------------------
| 3 | az | ononbonoj | 2 |
---------------------------------------------------------------
国家/地区表
-----------------------
| id | name |
-----------------------
| 1 | france |
-----------------------
| 2 | spain |
-----------------------
还有这些网址:
http://www.exemple.com/list/ (list all products)
http://www.exemple.com/add/ (add a new product)
http://www.exemple.com/detail/1 (print details about product with id=1)
我想要做的是让网站的访问者在他们的导航期间设置一个过滤器,所以对于产品列表的每次显示 根据过滤器,只会显示来自法国或西班牙的产品。
我可以使用 french.exemple.com 或 spain.exemple.com 来过滤结果,但我不想为每个 子域。
如何处理这个问题?
【问题讨论】:
标签: python django session implementation