Coder Social home page Coder Social logo

Comments (2)

lvtu0316 avatar lvtu0316 commented on May 22, 2024 1

我的django 版本是1.9 ,问题出在了get_all_field_names()方法(此方法在1.8后已经被删除了),作者有提示让测试了,我没有注意到,但是大家还是要注意到自己版本如果大于1.8会存在问题:

    def amend_model_params(self, **kwargs):
        params = kwargs.copy()
        if 'subscribe_time' in params:
            params['subscribe_time'] = \
                datetime.fromtimestamp(params['subscribe_time'], pytz.utc)
        params['subscribe'] = bool(params['subscribe'])
        params['last_login'] = timezone.now()
        # TODO get_all_field_names is deprecated, need test case here
        field_list = WechatUser._meta.get_all_field_names()
        for field in params.keys():
            if field not in field_list:
                params.pop(field)
        return params

我是这样修改的:

def amend_model_params(self, **kwargs):
        params = kwargs.copy()
        if 'subscribe_time' in params:
            params['subscribe_time'] = \
                datetime.fromtimestamp(params['subscribe_time'], pytz.utc)
        params['subscribe'] = bool(params['subscribe'])
        params['last_login'] = timezone.now()
        # TODO get_all_field_names is deprecated, need test case here
        field_list = WechatUser._meta.fields
        fields = []
        for field in field_list:
            fields.append(field.name)

        for field in params.keys():
            if field not in fields:
                params.pop(field)
        return params

from wecron.

polyrabbit avatar polyrabbit commented on May 22, 2024

这是你本地数据库的报错吧,跟WeCron没有关系。。。

from wecron.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.