开发者

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

开发者 https://www.devze.com 2023-04-13 05:49 出处:网络
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 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

精彩评论

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