且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用基于UpdateView的Django更新用户模型

更新时间:2023-09-28 22:05:46

我需要在更新视图上覆盖 get_object()方法,不要需要重写form_valid。自定义 get_object()方法是:

I need to override the get_object() method on the update view and do not need to override form_valid. The custom get_object() method is:

    def get_object(self, queryset=None):
        return self.request.user