当前位置: 首页>>代码示例>>Python>>正文


Python FormView.get_context_data方法代码示例

本文整理汇总了Python中django.views.generic.FormView.get_context_data方法的典型用法代码示例。如果您正苦于以下问题:Python FormView.get_context_data方法的具体用法?Python FormView.get_context_data怎么用?Python FormView.get_context_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在django.views.generic.FormView的用法示例。


在下文中一共展示了FormView.get_context_data方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_context_data

# 需要导入模块: from django.views.generic import FormView [as 别名]
# 或者: from django.views.generic.FormView import get_context_data [as 别名]
 def get_context_data(self, **kwargs):
     context = super(BaseAccessListLab, self).get_context_data(
         **kwargs)
     context.update(FormView.get_context_data(self, **kwargs))
     context['role'] = self.role
     context['user_create_form'] = self.user_create_form()
     return context
开发者ID:solvo,项目名称:organilab,代码行数:9,代码来源:access.py

示例2: get_context_data

# 需要导入模块: from django.views.generic import FormView [as 别名]
# 或者: from django.views.generic.FormView import get_context_data [as 别名]
    def get_context_data(self, **kwargs):
        """ Get Win data for use in the template """

        context = FormView.get_context_data(self, **kwargs)
        context.update({"win": self.win_dict})
        context['win']['date'] = date_parser(self.win_dict['date'])
        return context
开发者ID:UKTradeInvestment,项目名称:export-wins-ui,代码行数:9,代码来源:views.py

示例3: get_context_data

# 需要导入模块: from django.views.generic import FormView [as 别名]
# 或者: from django.views.generic.FormView import get_context_data [as 别名]
 def get_context_data(self, **kwargs):
     ctx = FormView.get_context_data(self, **kwargs)
     basket = self.request.basket  # type: shoop.front.basket.objects.BaseBasket
     ctx["basket"] = basket
     errors = list(basket.get_validation_errors(shop=self.request.shop))
     ctx["errors"] = errors
     ctx["orderable"] = (not errors)
     return ctx
开发者ID:noyonthe1,项目名称:shoop,代码行数:10,代码来源:single_page.py

示例4: get_context_data

# 需要导入模块: from django.views.generic import FormView [as 别名]
# 或者: from django.views.generic.FormView import get_context_data [as 别名]
 def get_context_data(self, **kwargs):
     ctx = FormView.get_context_data(self, **kwargs)
     basket = self.request.basket  # type: shoop.front.basket.objects.BaseBasket
     ctx["basket"] = basket
     basket.calculate_taxes()
     errors = list(basket.get_validation_errors())
     ctx["errors"] = errors
     ctx["orderable"] = not errors
     return ctx
开发者ID:cuberskulk,项目名称:shoop,代码行数:11,代码来源:single_page.py

示例5: get_context_data

# 需要导入模块: from django.views.generic import FormView [as 别名]
# 或者: from django.views.generic.FormView import get_context_data [as 别名]
 def get_context_data(self, **kwargs):
     """ pass args form get to template as context 
     
     the add_choices context is to give how many additional input choices
     to the form
     
     """
     context = FormView.get_context_data(self, **kwargs)
     
     # checking from POST request
     request_choice = self.request.POST.get('request_choice',0)
     last_choice = int (request_choice) - 2 if request_choice else 0
     
     # assign from last_choice, ignore from GET, because input from POST
     # from javascript has higher precedence than GET
     if last_choice :
         context['add_choices'] =  last_choice
     else :
         # checking from arguments (GET)
         # get previous total choices in the form, if exist
         previous = int(self.args[1])if len (self.args) == 2 else 0
         context['add_choices'] = int(self.args[0]) + previous if len(self.args) > 0 else 0
     
     return context 
开发者ID:drayanaindra,项目名称:polling,代码行数:26,代码来源:views.py

示例6: get_context_data

# 需要导入模块: from django.views.generic import FormView [as 别名]
# 或者: from django.views.generic.FormView import get_context_data [as 别名]
 def get_context_data(self, **kwargs):
     context = FormView.get_context_data(self, **kwargs)
     context['page_title'] = self.page_title
     return context
开发者ID:copasi,项目名称:cloud-copasi,代码行数:6,代码来源:views.py

示例7: get_context_data

# 需要导入模块: from django.views.generic import FormView [as 别名]
# 或者: from django.views.generic.FormView import get_context_data [as 别名]
 def get_context_data(self, **kwargs):
     context = FormView.get_context_data(self, **kwargs)
     context['page_title'] = self.page_title
     context['allow_new_registrations'] = settings.ALLOW_NEW_REGISTRATIONS
     return context
开发者ID:edkent,项目名称:cloud-copasi,代码行数:7,代码来源:account_views.py


注:本文中的django.views.generic.FormView.get_context_data方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。