Recibo un error de este tipo cuando intento eliminar un usuario del panel de administración

TypeError at /admin/auth/user/ 'bool' object is not callable

modelos.py

class PROFILE(models.Model):
kullanıcı = models.OneToOneField(User,on_delete=True)
birthday = models.DateField(verbose_name="Birthday",
                            blank=False,null=False)
gender   = models.CharField(max_length=15, blank=False,null=
                            False,choices=gender)
language = models.CharField(max_length=20, blank=False,null=False,
                            verbose_name="language",choices=languages)


def set_token(self):

    self.token = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789') 
                                for i in range(15)])

def save(self, *args, **kwargs):
    super(PROFILE, self).save(*args, **kwargs)
    self.set_token()

class Meta:

    verbose_name_plural = 'PROFILE'
    ordering= ["id"]

def __str__(self):
    return "{}".format(self.kullanıcı.username)



class Q(models.Model):
   author  = models.ForeignKey(User, on_delete=models.CASCADE)
   ... class Meta, __str__ ....

En primer lugar, 'kullanıcı' era 'usuario', pero lo cambié debido a la posibilidad de conflicto con django. Pero todavía tengo este problema.

TypeError at /admin/auth/user/ 'bool' object is not callable Request Method: POST Request URL: http://192.168.1.34:8000/admin/auth/user/ Django Version: 2.1 Exception Type: TypeError Exception Value:
'bool' object is not callable Exception Location: /home/mete/Masaüstü/ask/venv/lib/python3.6/site-packages/django/db/models/deletion.py in collect, line 221 Python Executable: /home/mete/Masaüstü/ask/venv/bin/python Python Version: 3.6.5 Python Path:
['/home/mete/Masaüstü/ask/ask', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/home/mete/Masaüstü/ask/venv/lib/python3.6/site-packages'] Server time: Cum, 31 Ağu 2018 16:35:51 +0000

>

Traceback: File "/home/mete/Masaüstü/ask/venv/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner 34. response = get_response(request) File "/home/mete/Masaüstü/ask/venv/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response 126. response = self.process_exception_by_middleware(e, request) File "/home/mete/Masaüstü/ask/venv/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response 124. response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/home/mete/Masaüstü/ask/venv/lib/python3.6/site-packages/django/contrib/admin/options.py" in wrapper 607. return self.admin_site.admin_view(view)(*args, **kwargs) File "/home/mete/Masaüstü/ask/venv/lib/python3.6/site-packages/django/utils/decorators.py" in _wrapped_view 142. response = view_func(request, *args, **kwargs) File "/home/mete/Masaüstü/ask/venv/lib/python3.6/site-packages/django/views/decorators/cache.py" in _wrapped_view_func 44. response = view_func(request, *args, **kwargs) File "/home/mete/Masaüstü/ask/venv/lib/python3.6/site-packages/django/contrib/admin/sites.py" in inner 223. return view(request, *args, **kwargs) File "/home/mete/Masaüstü/ask/venv/lib/python3.6/site-packages/django/utils/decorators.py" in _wrapper 45. return bound_method(*args, **kwargs) File "/home/mete/Masaüstü/ask/venv/lib/python3.6/site-packages/django/utils/decorators.py" in _wrapped_view 142. response = view_func(request, *args, **kwargs) File "/home/mete/Masaüstü/ask/venv/lib/python3.6/site-packages/django/contrib/admin/options.py" in changelist_view 1711. response = self.response_action(request, queryset=cl.get_queryset(request)) File "/home/mete/Masaüstü/ask/venv/lib/python3.6/site-packages/django/contrib/admin/options.py" in response_action 1411. response = func(self, request, queryset) File "/home/mete/Masaüstü/ask/venv/lib/python3.6/site-packages/django/contrib/admin/actions.py" in delete_selected 28. deletable_objects, model_count, perms_needed, protected = modeladmin.get_deleted_objects(queryset, request)> File "/home/mete/Masaüstü/ask/venv/lib/python3.6/site-packages/django/contrib/admin/options.py" in get_deleted_objects 1833. return get_deleted_objects(objs, request, self.admin_site) File "/home/mete/Masaüstü/ask/venv/lib/python3.6/site-packages/django/contrib/admin/utils.py" in get_deleted_objects 134. collector.collect(objs) File "/home/mete/Masaüstü/ask/venv/lib/python3.6/site-packages/django/contrib/admin/utils.py" in collect 197. return super().collect(objs, source_attr=source_attr, **kwargs) File "/home/mete/Masaüstü/ask/venv/lib/python3.6/site-packages/django/db/models/deletion.py" in collect 221. field.remote_field.on_delete(self, field, sub_objs, self.using)

Exception Type: TypeError at /admin/auth/user/ Exception Value: 'bool' object is not callable

respuesta

El problema está en su on_deleteargumento de Profilemodelo.

El on_deleteargumento no debe ser un valor booleano . Los valores posibles para on_deletepueden encontrarse aquí, Campo relacionado-on_delete .

Entonces, cambia tu PROFILEcomo,

class PROFILE(models.Model):
    kullanıcı = models.OneToOneField(User,on_delete=models.CASCADE)
    .... other fields