我想直接从另一个调用视图(如果这是在所有可能的)。我有一个观点:Django的:直接(在线)传递一个请求到第二视图
def product_add(request, order_id=None):
# Works. Handles a normal POST check and form submission and redirects
# to another page if the form is properly validated.
然后我有第二个观点,即查询DB的产品数据和应调用的第一个。
def product_copy_from_history(request, order_id=None, product_id=None):
product = Product.objects.get(owner=request.user, pk=product_id)
# I need to somehow setup a form with the product data so that the first
# view thinks it gets a post request.
2nd_response = product_add(request, order_id)
return 2nd_response
由于第二个需要增加产品作为第一种观点确实是我想知道如果我可以调用从第二个第一视图。
我的目标是什么的只是通过request对象传递给第二个观点,进而返回所得到的响应对象返回给客户端。
任何帮助非常感谢,critism以及如果这是一个糟糕的方式做到这一点。但是,接下来的一些提示是为了避免干燥。
Thanx!
杰拉德。
应该没问题。它工作吗? – 2009-12-12 13:52:57