Django-admin: "super () argument 1 must be a type, not None" when overriding the save method

Well, another useless mistake made me spend an hour trying to figure this out.

I have a "CompanyProfile" model that works until recently, but now when I try to save the model via admin, I get an error message that, it seems to me, indicates that the Object link is null. I have no idea how to sort this.

I do everything as usual:

def save(self, force_insert=False, force_update=False):
    super(CompanyProfile, self).save(force_insert, force_update)

I restarted the server, reinstalled django, cleared the database and still have no luck. Does anyone have any ideas or have they had this problem before?

+3
source share
4 answers

Maybe this is a cyclical import problem? http://markmail.org/message/zothlfayqkbidqfh#query:+page:1+mid{cnpcw3e4cgo3cas+state:results

In the example here, he had an import statement in the signal that was the culprit.

You can check globals () for similar symptoms.

+4
source

When overriding model methods, you need to use args / kwargs: http://docs.djangoproject.com/en/dev/topics/db/models/#overriding-model-methods

, , - * args, ** kwargs . Django , . * args, ** kwargs , , , .

+1

save() . *args, **kwargs. , - .

+1

, CompanyProfile ?

0

Source: https://habr.com/ru/post/1779633/


All Articles