簡體   English   中英

Django無法設置內置/擴展類型'object'的屬性

[英]Django can't set attributes of built-in/extension type 'object'

誰能看到與此有關的問題?

def is_valid(self, bundle, request=None):

    errors = {}
    # Check if user already exists before allowing API to create a new one.
    this_email = bundle.data.get('email', None)
    object.count = MemberParticipant.objects.filter(email=this_email).count()
    if object.count != 0:
         errors['Login']='Duplicate email address! A  participant with the ' \
                         'email address %s already exists.' % this_email
    return errors

我收到以下錯誤:

無法設置內置/擴展類型“對象”的屬性

我正在使用Tastypie的自定義驗證器

您是否正在嘗試將object.count用作單個變量名? 在不觸發屬性解析的情況下,您無法將點混入標識符中-使用object_count東西代替。 如所寫,您正在嘗試重新分配內置object類的count屬性。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM