Python django.views.generic.edit 模块,FormView() 实例源码

我们从Python开源项目中,提取了以下5个代码示例,用于说明如何使用django.views.generic.edit.FormView()

项目:nrp    作者:django-rea    | 项目源码 | 文件源码
def get_form_class(self):
        # @@@ django: this is a workaround to not having a dedicated method
        # to initialize self with a request in a known good state (of course
        # this only works with a FormView)
        self.primary_email_address = EmailAddress.objects.get_primary(self.request.user)
        return super(SettingsView, self).get_form_class()
项目:nrp    作者:django-rea    | 项目源码 | 文件源码
def get_form_class(self):
        # @@@ django: this is a workaround to not having a dedicated method
        # to initialize self with a request in a known good state (of course
        # this only works with a FormView)
        self.primary_email_address = EmailAddress.objects.get_primary(self.request.user)
        return super(WorkSettingsView, self).get_form_class()
项目:wagtail_room_booking    作者:Tamriel    | 项目源码 | 文件源码
def get_form_class(self):
        # @@@ django: this is a workaround to not having a dedicated method
        # to initialize self with a request in a known good state (of course
        # this only works with a FormView)
        self.primary_email_address = EmailAddress.objects.get_primary(self.request.user)
        return super(SettingsView, self).get_form_class()
项目:mes    作者:osess    | 项目源码 | 文件源码
def get_form_class(self):
        # @@@ django: this is a workaround to not having a dedicated method
        # to initialize self with a request in a known good state (of course
        # this only works with a FormView)
        self.primary_email_address = EmailAddress.objects.get_primary(self.request.user)
        return super(SettingsView, self).get_form_class()
项目:maidstone-hackspace-website    作者:maidstone-hackspace    | 项目源码 | 文件源码
def form_valid(self, form):
        if form.is_valid():
            obj = form.save(commit=False)
            obj.user = self.request.user
            obj.save()
            messages.add_message(self.request, messages.INFO, 'Request successfully made.')
        return super(FormView, self).form_valid(form)