我似乎无法在模型管理器中访问函数。
models.py
class ChargeManager(models.Manager):
def dorefundcharge(self, charge_id):
print(charge_id)
class Charge(models.Model):
charge_id = models.CharField(max_length=120)
objects = ChargeManager()
views.py
charge_id = 1234
refund_of_charge = charge.dorefundcharge(charge_id)
错误
AttributeError at /accounts/profile/refundcharge/540/
'Charge' object has no attribute 'dorefundcharge'
答案 0 :(得分:1)