开发者

Django: How to place a form in all subsites and process it on 1 url?

I need to place a form in all my subsites and home page. It's placed on right column. It's action is "/". If there are some errors I must display them. I made Form class etc. I display it v开发者_如何学运维ia {{ form.as_p }} and designed all.

The problem is - how to put it on all sites? I don't want to make form instance in all my views functions.

What is the best solution for that?


Looks like a work for a context processor. :-)

def my_form_processor(request):
    return {'my_form': MyForm()}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜