English 中文(简体)
Django的SélectT是否有变化活动?
原标题:Does SELECT in Django comes with onchange event?

User goes to a page which has a SELECT choice list. Once he picks a choice, without submit button, but rather by SELECTION, we render a new page which is process by a different view (in a different app).

CHOICES = {( EDIT , EDIT ), ( ASSIGN ,  ASSIGN ), # etc # }
select = forms.CharField(widget=forms.Select(choices=CHOICES))

Now, I am pretty clueless how to go about writing my view.

choice_view.py renders choice.html; then choosing EDIT process by edit.py with some parameters.

rel=“nofollow”http:// localhost/url_1/ 之后,

Can someone lead me in the right direction?

Thank you!

最佳回答

你可以尝试如下:

首先,将<代码>http:// localhost/url_2/的URL定义为<>,para amountsview。 这里的观点载于文件edit.py

然后,在<代码>的模板中(http:// localhost/url_1/,即choice.html)上,写了一份JQuery代码,其中界定了在选定的领域上的Change功能。 在地库功能中,将“URL”称作“编码”http:// localhost/url_2/,并以其名称通过选定的外地价值作为参数。 您可使用<代码>window. place.href 称呼URL。 这将把你转至<代码>http:// localhost/url_2/。

edit.py的角度来看,你可以进一步撰写程序守则。

问题回答

暂无回答




相关问题
How to get two random records with Django

How do I get two distinct random records using Django? I ve seen questions about how to get one but I need to get two random records and they must differ.

Moving (very old) Zope/Plone Site to Django

I am ask to move data from a (now offline) site driven by Plone to a new Django site. These are the version informations I have: Zope Version (unreleased version, python 2.1.3 ) Python Version 2.1....

Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

Flexible pagination in Django

I d like to implement pagination such that I can allow the user to choose the number of records per page such as 10, 25, 50 etc. How should I go about this? Is there an app I can add onto my project ...

is it convenient to urlencode all next parameters? - django

While writing code, it is pretty common to request a page with an appended "next" query string argument. For instance, in the following template code next points back to the page the user is on: &...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

热门标签