English 中文(简体)
Django表格令人担心——通过请求?
原标题:Django form wizard - passing request to the view?

能否在表格Wizard的()方法中查阅<代码>request变量?

class AddWizard(SessionWizardView):
    def done(self, form_list, **kwargs):
        if form_list[0].cleaned_data[ ad_type ] ==  1 :
            ad_type =  basic 
        else:
            ad_type =  other 
        return render_to_response( business/done.html , {
             form_data : ad_type,
            },
            context_instance = RequestContext(request)
        )

我希望能查阅请求中的用户标语,但我不敢肯定,我会如何将请求转至已采用的方法?

问题回答

是:SessionWizard 观点 扩展“普通<代码>,以便可在<代码>上查询。

文件:https://docs.djangoproject.com/en/1.5/topics/class-views/generic-display/#dynamic-filtering





相关问题
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 ...

热门标签