Sunday, March 29, 2015

Re: Django system check gives error when storing method in variable

Hey Wouter,

since Django 1.7 Model.check() is a reserved method that is used by the system checks framework (https://docs.djangoproject.com/en/1.7/topics/checks/#field-model-and-manager-checks). The cleanest way is to remove that line (check = is_paid). Why do you have that in the first place?

/Markus

On Sunday, March 29, 2015 at 6:01:04 PM UTC+2, Wouter Miltenburg wrote:
Hi all,

Haven't used Django 1.7.7 till today, but whenever I want to launch my
project I get the following error:
ERRORS:
gopro.MyPayment: (models.E020) The 'MyPayment.check()' class method is
currently overridden by <function MollieIdealPayment.is_paid at
0x7f0716731b90>.

I use another django app
(https://github.com/wmiltenburg/django-mollie-ideal) inside the app that
I am currently writing. The problem seems to be relating to line 75 in
models.py
(https://github.com/wmiltenburg/django-mollie-ideal/blob/master/mollie/ideal/models.py,
check = is_paid), where is_paid is a method. If I comment it out it
works fine. However, this used to work in previous Django releases (1.6)
and it is valid Python code. In Django 1.7 it shows the following error:
TypeError: is_paid() missing 1 required positional argument: 'self'.

The error shows up when Django performs the system checks. My guess is
that the "system check" from Django 1.7 doesn't handle function
referencing in Python well (which used to be in Django 1.6). However, I
am wondering if this is a more of a general problem in Django itself and
if other users experience the same problem.

Cheers,
Wouter.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/591911f5-9f54-4099-82f5-8a9e15b1fa7b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment