python类FormView()的实例源码

views.py 文件源码 项目:nrp 作者: django-rea 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
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()
views.py 文件源码 项目:nrp 作者: django-rea 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
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()
views.py 文件源码 项目:wagtail_room_booking 作者: Tamriel 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
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()
views.py 文件源码 项目:mes 作者: osess 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
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()
views.py 文件源码 项目:maidstone-hackspace-website 作者: maidstone-hackspace 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
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)


问题


面经


文章

微信
公众号

扫码关注公众号