Field 'id' expected a number but got <django.contrib.auth.models.AnonymousUser object at 0x7efc24e95610>.
Request Method: | GET |
---|---|
Request URL: | https://www.mrpy.ir/notifications/clear/?url=/ |
Django Version: | 3.2.7 |
Exception Type: | TypeError |
Exception Value: | Field 'id' expected a number but got <django.contrib.auth.models.AnonymousUser object at 0x7efc24e95610>. |
Exception Location: | /home1/mrpyir/virtualenv/repositories/mrpy/3.7/lib/python3.7/site-packages/django/db/models/fields/__init__.py, line 1827, in get_prep_value |
Python Executable: | /home1/mrpyir/virtualenv/repositories/mrpy/3.7/bin/python |
Python Version: | 3.7.17 |
Python Path: | ['', '/home1/mrpyir/repositories/mrpy', '/opt/alt/python37/lib64/python37.zip', '/opt/alt/python37/lib64/python3.7', '/opt/alt/python37/lib64/python3.7/lib-dynload', '/home1/mrpyir/virtualenv/repositories/mrpy/3.7/lib64/python3.7/site-packages', '/home1/mrpyir/virtualenv/repositories/mrpy/3.7/lib/python3.7/site-packages'] |
Server time: | Fri, 29 Mar 2024 15:49:29 +0430 |
/home1/mrpyir/virtualenv/repositories/mrpy/3.7/lib/python3.7/site-packages/django/db/models/fields/__init__.py
, line 1823, in get_prep_value
return validators_
def get_prep_value(self, value):
value = super().get_prep_value(value)
if value is None:
return None
try:
return int(value)…
except (TypeError, ValueError) as e:
raise e.__class__(
"Field '%s' expected a number but got %r." % (self.name, value),
) from e
def get_internal_type(self):
Variable | Value |
---|---|
__class__ | <class 'django.db.models.fields.IntegerField'> |
self | <django.db.models.fields.BigAutoField: id> |
value | <django.contrib.auth.models.AnonymousUser object at 0x7efc24e95610> |
/home1/mrpyir/virtualenv/repositories/mrpy/3.7/lib/python3.7/site-packages/django/contrib/auth/models.py
, line 420, in __int__
def __eq__(self, other):
return isinstance(other, self.__class__)
def __hash__(self):
return 1 # instances always return the same hash value
def __int__(self):
raise TypeError('Cannot cast AnonymousUser to int. Are you trying to use it in place of User?')…
def save(self):
raise NotImplementedError("Django doesn't provide a DB representation for AnonymousUser.")
def delete(self):
raise NotImplementedError("Django doesn't provide a DB representation for AnonymousUser.")
Variable | Value |
---|---|
self | <django.contrib.auth.models.AnonymousUser object at 0x7efc24e95610> |
/home1/mrpyir/virtualenv/repositories/mrpy/3.7/lib/python3.7/site-packages/django/core/handlers/exception.py
, line 47, in inner
response = await sync_to_async(response_for_exception, thread_sensitive=False)(request, exc)
return response
return inner
else:
@wraps(get_response)
def inner(request):
try:
response = get_response(request)…
except Exception as exc:
response = response_for_exception(request, exc)
return response
return inner
Variable | Value |
---|---|
exc | TypeError("Field 'id' expected a number but got <django.contrib.auth.models.AnonymousUser object at 0x7efc24e95610>.") |
get_response | <bound method BaseHandler._get_response of <django.core.handlers.wsgi.WSGIHandler object at 0x7efc2671fcd0>> |
request | <WSGIRequest: GET '/notifications/clear/?url=/'> |
/home1/mrpyir/virtualenv/repositories/mrpy/3.7/lib/python3.7/site-packages/django/core/handlers/base.py
, line 181, in _get_response
if response is None:
wrapped_callback = self.make_view_atomic(callback)
# If it is an asynchronous view, run it in a subthread.
if asyncio.iscoroutinefunction(wrapped_callback):
wrapped_callback = async_to_sync(wrapped_callback)
try:
response = wrapped_callback(request, *callback_args, **callback_kwargs)…
except Exception as e:
response = self.process_exception_by_middleware(e, request)
if response is None:
raise
# Complain if the view returned None (a common error).
Variable | Value |
---|---|
callback | <function WrappedAPIView at 0x7efc2553e710> |
callback_args | () |
callback_kwargs | {} |
middleware_method | <bound method CsrfViewMiddleware.process_view of <django.middleware.csrf.CsrfViewMiddleware object at 0x7efc26309d10>> |
request | <WSGIRequest: GET '/notifications/clear/?url=/'> |
response | None |
self | <django.core.handlers.wsgi.WSGIHandler object at 0x7efc2671fcd0> |
wrapped_callback | <function WrappedAPIView at 0x7efc2553e710> |
/home1/mrpyir/virtualenv/repositories/mrpy/3.7/lib/python3.7/site-packages/django/views/decorators/csrf.py
, line 54, in wrapped_view
def csrf_exempt(view_func):
"""Mark a view function as being exempt from the CSRF view protection."""
# view_func.csrf_exempt = True would also work, but decorators are nicer
# if they don't have side effects, so return a new function.
def wrapped_view(*args, **kwargs):
return view_func(*args, **kwargs)…
wrapped_view.csrf_exempt = True
return wraps(view_func)(wrapped_view)
Variable | Value |
---|---|
args | (<WSGIRequest: GET '/notifications/clear/?url=/'>,) |
kwargs | {} |
view_func | <function WrappedAPIView at 0x7efc2553e680> |
/home1/mrpyir/virtualenv/repositories/mrpy/3.7/lib/python3.7/site-packages/django/views/generic/base.py
, line 70, in view
self = cls(**initkwargs)
self.setup(request, *args, **kwargs)
if not hasattr(self, 'request'):
raise AttributeError(
"%s instance has no 'request' attribute. Did you override "
"setup() and forget to call super()?" % cls.__name__
)
return self.dispatch(request, *args, **kwargs)…
view.view_class = cls
view.view_initkwargs = initkwargs
# take name and docstring from class
update_wrapper(view, cls, updated=())
Variable | Value |
---|---|
args | () |
cls | <class 'apps.views.WrappedAPIView'> |
initkwargs | {} |
kwargs | {} |
request | <WSGIRequest: GET '/notifications/clear/?url=/'> |
self | <apps.views.WrappedAPIView object at 0x7efc24e95210> |
/home1/mrpyir/virtualenv/repositories/mrpy/3.7/lib/python3.7/site-packages/rest_framework/views.py
, line 509, in dispatch
self.http_method_not_allowed)
else:
handler = self.http_method_not_allowed
response = handler(request, *args, **kwargs)
except Exception as exc:
response = self.handle_exception(exc)…
self.response = self.finalize_response(request, response, *args, **kwargs)
return self.response
def options(self, request, *args, **kwargs):
"""
Variable | Value |
---|---|
args | () |
handler | <bound method api_view.<locals>.decorator.<locals>.handler of <apps.views.WrappedAPIView object at 0x7efc24e95210>> |
kwargs | {} |
request | <rest_framework.request.Request: GET '/notifications/clear/?url=/'> |
self | <apps.views.WrappedAPIView object at 0x7efc24e95210> |
/home1/mrpyir/virtualenv/repositories/mrpy/3.7/lib/python3.7/site-packages/rest_framework/views.py
, line 469, in handle_exception
exception_handler = self.get_exception_handler()
context = self.get_exception_handler_context()
response = exception_handler(exc, context)
if response is None:
self.raise_uncaught_exception(exc)…
response.exception = True
return response
def raise_uncaught_exception(self, exc):
if settings.DEBUG:
Variable | Value |
---|---|
context | {'args': (), 'kwargs': {}, 'request': <rest_framework.request.Request: GET '/notifications/clear/?url=/'>, 'view': <apps.views.WrappedAPIView object at 0x7efc24e95210>} |
exc | TypeError("Field 'id' expected a number but got <django.contrib.auth.models.AnonymousUser object at 0x7efc24e95610>.") |
exception_handler | <function exception_handler at 0x7efc2558a290> |
response | None |
self | <apps.views.WrappedAPIView object at 0x7efc24e95210> |
/home1/mrpyir/virtualenv/repositories/mrpy/3.7/lib/python3.7/site-packages/rest_framework/views.py
, line 480, in raise_uncaught_exception
def raise_uncaught_exception(self, exc):
if settings.DEBUG:
request = self.request
renderer_format = getattr(request.accepted_renderer, 'format')
use_plaintext_traceback = renderer_format not in ('html', 'api', 'admin')
request.force_plaintext_errors(use_plaintext_traceback)
raise exc…
# Note: Views are made CSRF exempt from within `as_view` as to prevent
# accidental removal of this exemption in cases where `dispatch` needs to
# be overridden.
def dispatch(self, request, *args, **kwargs):
"""
Variable | Value |
---|---|
exc | TypeError("Field 'id' expected a number but got <django.contrib.auth.models.AnonymousUser object at 0x7efc24e95610>.") |
renderer_format | 'json' |
request | <rest_framework.request.Request: GET '/notifications/clear/?url=/'> |
self | <apps.views.WrappedAPIView object at 0x7efc24e95210> |
use_plaintext_traceback | True |
/home1/mrpyir/virtualenv/repositories/mrpy/3.7/lib/python3.7/site-packages/rest_framework/views.py
, line 506, in dispatch
# Get the appropriate handler method
if request.method.lower() in self.http_method_names:
handler = getattr(self, request.method.lower(),
self.http_method_not_allowed)
else:
handler = self.http_method_not_allowed
response = handler(request, *args, **kwargs)…
except Exception as exc:
response = self.handle_exception(exc)
self.response = self.finalize_response(request, response, *args, **kwargs)
return self.response
Variable | Value |
---|---|
args | () |
handler | <bound method api_view.<locals>.decorator.<locals>.handler of <apps.views.WrappedAPIView object at 0x7efc24e95210>> |
kwargs | {} |
request | <rest_framework.request.Request: GET '/notifications/clear/?url=/'> |
self | <apps.views.WrappedAPIView object at 0x7efc24e95210> |
/home1/mrpyir/virtualenv/repositories/mrpy/3.7/lib/python3.7/site-packages/rest_framework/decorators.py
, line 50, in handler
assert isinstance(http_method_names, (list, tuple)), \
'@api_view expected a list of strings, received %s' % type(http_method_names).__name__
allowed_methods = set(http_method_names) | {'options'}
WrappedAPIView.http_method_names = [method.lower() for method in allowed_methods]
def handler(self, *args, **kwargs):
return func(*args, **kwargs)…
for method in http_method_names:
setattr(WrappedAPIView, method.lower(), handler)
WrappedAPIView.__name__ = func.__name__
WrappedAPIView.__module__ = func.__module__
Variable | Value |
---|---|
args | (<rest_framework.request.Request: GET '/notifications/clear/?url=/'>,) |
func | <function clear_notifications at 0x7efc2553e4d0> |
kwargs | {} |
self | <apps.views.WrappedAPIView object at 0x7efc24e95210> |
/home1/mrpyir/repositories/mrpy/apps/views.py
, line 250, in clear_notifications
n.visit = True
n.save()
return render(request, 'notifications/notifications.html', context={'all_notifications': my_notifications})
@api_view(['GET'])
def clear_notifications(request):
my_notifications = Notification.objects.filter(user=request.user).filter(visit=False)…
for n in my_notifications:
n.visit = True
n.save()
data = {"r": "ok"}
return Response(data=data, status=200)
Variable | Value |
---|---|
request | <rest_framework.request.Request: GET '/notifications/clear/?url=/'> |
/home1/mrpyir/virtualenv/repositories/mrpy/3.7/lib/python3.7/site-packages/django/db/models/manager.py
, line 85, in manager_method
def check(self, **kwargs):
return []
@classmethod
def _get_queryset_methods(cls, queryset_class):
def create_method(name, method):
def manager_method(self, *args, **kwargs):
return getattr(self.get_queryset(), name)(*args, **kwargs)…
manager_method.__name__ = method.__name__
manager_method.__doc__ = method.__doc__
return manager_method
new_methods = {}
for name, method in inspect.getmembers(queryset_class, predicate=inspect.isfunction):
Variable | Value |
---|---|
args | () |
kwargs | {'user': <django.contrib.auth.models.AnonymousUser object at 0x7efc24e95610>} |
name | 'filter' |
self | <django.db.models.manager.Manager object at 0x7efc24e95590> |
/home1/mrpyir/virtualenv/repositories/mrpy/3.7/lib/python3.7/site-packages/django/db/models/query.py
, line 941, in filter
def filter(self, *args, **kwargs):
"""
Return a new QuerySet instance with the args ANDed to the existing
set.
"""
self._not_support_combined_queries('filter')
return self._filter_or_exclude(False, args, kwargs)…
def exclude(self, *args, **kwargs):
"""
Return a new QuerySet instance with NOT (args) ANDed to the existing
set.
"""
Variable | Value |
---|---|
args | () |
kwargs | {'user': <django.contrib.auth.models.AnonymousUser object at 0x7efc24e95610>} |
self | <QuerySet [<Notification: Notification object (1616)>, <Notification: Notification object (1617)>, <Notification: Notification object (1618)>, <Notification: Notification object (1619)>, <Notification: Notification object (1620)>, <Notification: Notification object (1621)>, <Notification: Notification object (1622)>, <Notification: Notification object (1623)>, <Notification: Notification object (1624)>, <Notification: Notification object (1625)>, <Notification: Notification object (1626)>, <Notification: Notification object (1627)>, <Notification: Notification object (1628)>, <Notification: Notification object (1629)>, <Notification: Notification object (1630)>, <Notification: Notification object (1631)>, <Notification: Notification object (1632)>, <Notification: Notification object (1633)>, <Notification: Notification object (1634)>, <Notification: Notification object (1635)>, '...(remaining elements truncated)...']> |
/home1/mrpyir/virtualenv/repositories/mrpy/3.7/lib/python3.7/site-packages/django/db/models/query.py
, line 961, in _filter_or_exclude
"Cannot filter a query once a slice has been taken."
clone = self._chain()
if self._defer_next_filter:
self._defer_next_filter = False
clone._deferred_filter = negate, args, kwargs
else:
clone._filter_or_exclude_inplace(negate, args, kwargs)…
return clone
def _filter_or_exclude_inplace(self, negate, args, kwargs):
if negate:
self._query.add_q(~Q(*args, **kwargs))
else:
Variable | Value |
---|---|
args | () |
clone | <QuerySet [<Notification: Notification object (1616)>, <Notification: Notification object (1617)>, <Notification: Notification object (1618)>, <Notification: Notification object (1619)>, <Notification: Notification object (1620)>, <Notification: Notification object (1621)>, <Notification: Notification object (1622)>, <Notification: Notification object (1623)>, <Notification: Notification object (1624)>, <Notification: Notification object (1625)>, <Notification: Notification object (1626)>, <Notification: Notification object (1627)>, <Notification: Notification object (1628)>, <Notification: Notification object (1629)>, <Notification: Notification object (1630)>, <Notification: Notification object (1631)>, <Notification: Notification object (1632)>, <Notification: Notification object (1633)>, <Notification: Notification object (1634)>, <Notification: Notification object (1635)>, '...(remaining elements truncated)...']> |
kwargs | {'user': <django.contrib.auth.models.AnonymousUser object at 0x7efc24e95610>} |
negate | False |
self | <QuerySet [<Notification: Notification object (1616)>, <Notification: Notification object (1617)>, <Notification: Notification object (1618)>, <Notification: Notification object (1619)>, <Notification: Notification object (1620)>, <Notification: Notification object (1621)>, <Notification: Notification object (1622)>, <Notification: Notification object (1623)>, <Notification: Notification object (1624)>, <Notification: Notification object (1625)>, <Notification: Notification object (1626)>, <Notification: Notification object (1627)>, <Notification: Notification object (1628)>, <Notification: Notification object (1629)>, <Notification: Notification object (1630)>, <Notification: Notification object (1631)>, <Notification: Notification object (1632)>, <Notification: Notification object (1633)>, <Notification: Notification object (1634)>, <Notification: Notification object (1635)>, '...(remaining elements truncated)...']> |
/home1/mrpyir/virtualenv/repositories/mrpy/3.7/lib/python3.7/site-packages/django/db/models/query.py
, line 968, in _filter_or_exclude_inplace
clone._filter_or_exclude_inplace(negate, args, kwargs)
return clone
def _filter_or_exclude_inplace(self, negate, args, kwargs):
if negate:
self._query.add_q(~Q(*args, **kwargs))
else:
self._query.add_q(Q(*args, **kwargs))…
def complex_filter(self, filter_obj):
"""
Return a new QuerySet instance with filter_obj added to the filters.
filter_obj can be a Q object or a dictionary of keyword lookup
Variable | Value |
---|---|
args | () |
kwargs | {'user': <django.contrib.auth.models.AnonymousUser object at 0x7efc24e95610>} |
negate | False |
self | <QuerySet [<Notification: Notification object (1616)>, <Notification: Notification object (1617)>, <Notification: Notification object (1618)>, <Notification: Notification object (1619)>, <Notification: Notification object (1620)>, <Notification: Notification object (1621)>, <Notification: Notification object (1622)>, <Notification: Notification object (1623)>, <Notification: Notification object (1624)>, <Notification: Notification object (1625)>, <Notification: Notification object (1626)>, <Notification: Notification object (1627)>, <Notification: Notification object (1628)>, <Notification: Notification object (1629)>, <Notification: Notification object (1630)>, <Notification: Notification object (1631)>, <Notification: Notification object (1632)>, <Notification: Notification object (1633)>, <Notification: Notification object (1634)>, <Notification: Notification object (1635)>, '...(remaining elements truncated)...']> |
/home1/mrpyir/virtualenv/repositories/mrpy/3.7/lib/python3.7/site-packages/django/db/models/sql/query.py
, line 1393, in add_q
# For join promotion this case is doing an AND for the added q_object
# and existing conditions. So, any existing inner join forces the join
# type to remain inner. Existing outer joins can however be demoted.
# (Consider case where rel_a is LOUTER and rel_a__col=1 is added - if
# rel_a doesn't produce any rows, then the whole condition must fail.
# So, demotion is OK.
existing_inner = {a for a in self.alias_map if self.alias_map[a].join_type == INNER}
clause, _ = self._add_q(q_object, self.used_aliases)…
if clause:
self.where.add(clause, AND)
self.demote_joins(existing_inner)
def build_where(self, filter_expr):
return self.build_filter(filter_expr, allow_joins=False)[0]
Variable | Value |
---|---|
existing_inner | set() |
q_object | <Q: (AND: ('user', <django.contrib.auth.models.AnonymousUser object at 0x7efc24e95610>))> |
self | <django.db.models.sql.query.Query object at 0x7efc24e955d0> |
/home1/mrpyir/virtualenv/repositories/mrpy/3.7/lib/python3.7/site-packages/django/db/models/sql/query.py
, line 1415, in _add_q
target_clause = self.where_class(connector=connector,
negated=q_object.negated)
joinpromoter = JoinPromoter(q_object.connector, len(q_object.children), current_negated)
for child in q_object.children:
child_clause, needed_inner = self.build_filter(
child, can_reuse=used_aliases, branch_negated=branch_negated,
current_negated=current_negated, allow_joins=allow_joins,
split_subq=split_subq, check_filterable=check_filterable,…
)
joinpromoter.add_votes(needed_inner)
if child_clause:
target_clause.add(child_clause, connector)
needed_inner = joinpromoter.update_join_types(self)
return target_clause, needed_inner
Variable | Value |
---|---|
allow_joins | True |
branch_negated | False |
check_filterable | True |
child | ('user', <django.contrib.auth.models.AnonymousUser object at 0x7efc24e95610>) |
connector | 'AND' |
current_negated | False |
joinpromoter | <django.db.models.sql.query.JoinPromoter object at 0x7efc24e95810> |
q_object | <Q: (AND: ('user', <django.contrib.auth.models.AnonymousUser object at 0x7efc24e95610>))> |
self | <django.db.models.sql.query.Query object at 0x7efc24e955d0> |
split_subq | True |
target_clause | <WhereNode: (AND: )> |
used_aliases | {'apps_notification'} |
/home1/mrpyir/virtualenv/repositories/mrpy/3.7/lib/python3.7/site-packages/django/db/models/sql/query.py
, line 1347, in build_filter
if len(targets) == 1:
col = self._get_col(targets[0], join_info.final_field, alias)
else:
col = MultiColSource(alias, targets, join_info.targets, join_info.final_field)
else:
col = self._get_col(targets[0], join_info.final_field, alias)
condition = self.build_lookup(lookups, col, value)…
lookup_type = condition.lookup_name
clause.add(condition, AND)
require_outer = lookup_type == 'isnull' and condition.rhs is True and not current_negated
if current_negated and (lookup_type != 'isnull' or condition.rhs is False) and condition.rhs is not None:
require_outer = True
Variable | Value |
---|---|
alias | 'apps_notification' |
allow_joins | True |
allow_many | True |
arg | 'user' |
branch_negated | False |
can_reuse | {'apps_notification'} |
check_filterable | True |
clause | <WhereNode: (AND: )> |
col | Col(apps_notification, apps.Notification.user) |
current_negated | False |
filter_expr | ('user', <django.contrib.auth.models.AnonymousUser object at 0x7efc24e95610>) |
join_info | JoinInfo(final_field=<django.db.models.fields.related.ForeignKey: user>, targets=(<django.db.models.fields.BigAutoField: id>,), opts=<Options for User>, joins=['apps_notification', 'accounts_user'], path=[PathInfo(from_opts=<Options for Notification>, to_opts=<Options for User>, target_fields=(<django.db.models.fields.BigAutoField: id>,), join_field=<django.db.models.fields.related.ForeignKey: user>, m2m=False, direct=True, filtered_relation=None)], transform_function=<function Query.setup_joins.<locals>.final_transformer at 0x7efc24e5c710>) |
join_list | ['apps_notification'] |
lookups | [] |
num_lookups | 0 |
opts | <Options for Notification> |
parts | ['user'] |
pre_joins | {} |
reffed_expression | False |
reuse_with_filtered_relation | False |
self | <django.db.models.sql.query.Query object at 0x7efc24e955d0> |
split_subq | True |
targets | (<django.db.models.fields.related.ForeignKey: user>,) |
used_joins | {'apps_notification', 'accounts_user'} |
value | <django.contrib.auth.models.AnonymousUser object at 0x7efc24e95610> |
/home1/mrpyir/virtualenv/repositories/mrpy/3.7/lib/python3.7/site-packages/django/db/models/sql/query.py
, line 1193, in build_lookup
# and do an Exact lookup against it.
lhs = self.try_transform(lhs, lookup_name)
lookup_name = 'exact'
lookup_class = lhs.get_lookup(lookup_name)
if not lookup_class:
return
lookup = lookup_class(lhs, rhs)…
# Interpret '__exact=None' as the sql 'is NULL'; otherwise, reject all
# uses of None as a query value unless the lookup supports it.
if lookup.rhs is None and not lookup.can_use_none_as_rhs:
if lookup_name not in ('exact', 'iexact'):
raise ValueError("Cannot use None as a query value")
return lhs.get_lookup('isnull')(lhs, True)
Variable | Value |
---|---|
lhs | Col(apps_notification, apps.Notification.user) |
lookup_class | <class 'django.db.models.fields.related_lookups.RelatedExact'> |
lookup_name | 'exact' |
lookups | [] |
rhs | <django.contrib.auth.models.AnonymousUser object at 0x7efc24e95610> |
self | <django.db.models.sql.query.Query object at 0x7efc24e955d0> |
transforms | [] |
/home1/mrpyir/virtualenv/repositories/mrpy/3.7/lib/python3.7/site-packages/django/db/models/lookups.py
, line 25, in __init__
class Lookup:
lookup_name = None
prepare_rhs = True
can_use_none_as_rhs = False
def __init__(self, lhs, rhs):
self.lhs, self.rhs = lhs, rhs
self.rhs = self.get_prep_lookup()…
if hasattr(self.lhs, 'get_bilateral_transforms'):
bilateral_transforms = self.lhs.get_bilateral_transforms()
else:
bilateral_transforms = []
if bilateral_transforms:
# Warn the user as soon as possible if they are trying to apply
Variable | Value |
---|---|
lhs | Col(apps_notification, apps.Notification.user) |
rhs | <django.contrib.auth.models.AnonymousUser object at 0x7efc24e95610> |
self | <django.db.models.fields.related_lookups.RelatedExact object at 0x7efc24e958d0> |
/home1/mrpyir/virtualenv/repositories/mrpy/3.7/lib/python3.7/site-packages/django/db/models/fields/related_lookups.py
, line 117, in get_prep_lookup
# ForeignKey to IntegerField given value 'abc'. The ForeignKey itself
# doesn't have validation for non-integers, so we must run validation
# using the target field.
if self.prepare_rhs and hasattr(self.lhs.output_field, 'get_path_info'):
# Get the target field. We can safely assume there is only one
# as we don't get to the direct value branch otherwise.
target_field = self.lhs.output_field.get_path_info()[-1].target_fields[-1]
self.rhs = target_field.get_prep_value(self.rhs)…
return super().get_prep_lookup()
def as_sql(self, compiler, connection):
if isinstance(self.lhs, MultiColSource):
assert self.rhs_is_direct_value()
Variable | Value |
---|---|
__class__ | <class 'django.db.models.fields.related_lookups.RelatedLookupMixin'> |
self | <django.db.models.fields.related_lookups.RelatedExact object at 0x7efc24e958d0> |
target_field | <django.db.models.fields.BigAutoField: id> |
/home1/mrpyir/virtualenv/repositories/mrpy/3.7/lib/python3.7/site-packages/django/db/models/fields/__init__.py
, line 1827, in get_prep_value
if value is None:
return None
try:
return int(value)
except (TypeError, ValueError) as e:
raise e.__class__(
"Field '%s' expected a number but got %r." % (self.name, value),
) from e…
def get_internal_type(self):
return "IntegerField"
def to_python(self, value):
if value is None:
Variable | Value |
---|---|
__class__ | <class 'django.db.models.fields.IntegerField'> |
self | <django.db.models.fields.BigAutoField: id> |
value | <django.contrib.auth.models.AnonymousUser object at 0x7efc24e95610> |
AnonymousUser
Variable | Value |
---|---|
url | '/' |
No POST data
No FILES data
No cookie data
Variable | Value |
---|---|
HTTPS | 'on' |
HTTP_ACCEPT | '*/*' |
HTTP_HOST | 'www.mrpy.ir' |
HTTP_USER_AGENT | 'claudebot' |
HTTP_X_HTTPS | '1' |
PATH_INFO | '/notifications/clear/' |
QUERY_STRING | 'url=/' |
REMOTE_ADDR | '3.91.43.22' |
REMOTE_PORT | '52428' |
REQUEST_METHOD | 'GET' |
REQUEST_SCHEME | 'https' |
REQUEST_URI | '/notifications/clear/?url=/' |
SCRIPT_NAME | '' |
SCRIPT_URI | 'https://www.mrpy.ir/notifications/clear/' |
SCRIPT_URL | '/notifications/clear/' |
SERVER_ADDR | '185.128.136.186' |
SERVER_ADMIN | 'webmaster@mrpy.ir' |
SERVER_NAME | 'www.mrpy.ir' |
SERVER_PORT | '443' |
SERVER_PROTOCOL | 'HTTP/1.1' |
SERVER_SOFTWARE | 'LiteSpeed' |
SSL_CIPHER | 'TLS_AES_256_GCM_SHA384' |
SSL_CIPHER_ALGKEYSIZE | '********************' |
SSL_CIPHER_USEKEYSIZE | '********************' |
SSL_PROTOCOL | 'TLSv1.3' |
X-LSCACHE | 'on' |
X_SPDY | 'HTTP2' |
wsgi.errors | <_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'> |
wsgi.file_wrapper | <class 'lsapi_wsgi.FileWrapper'> |
wsgi.input | <lsapi_wsgi.InputStream object at 0x7efc24e8f9d0> |
wsgi.multiprocess | True |
wsgi.multithread | False |
wsgi.run_once | False |
wsgi.url_scheme | 'https' |
wsgi.version | (1, 0) |
config.settings
Setting | Value |
---|---|
ABSOLUTE_URL_OVERRIDES | {} |
ADMINS | [] |
ALLOWED_HOSTS | ['*'] |
APPEND_SLASH | True |
AUTHENTICATION_BACKENDS | ('social_core.backends.github.GithubOAuth2', 'social_core.backends.google.GoogleOAuth2', 'django.contrib.auth.backends.ModelBackend') |
AUTH_PASSWORD_VALIDATORS | '********************' |
AUTH_USER_MODEL | 'accounts.User' |
BASE_DIR | PosixPath('/home1/mrpyir/repositories/mrpy') |
CACHES | {'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}} |
CACHE_MIDDLEWARE_ALIAS | 'default' |
CACHE_MIDDLEWARE_KEY_PREFIX | '********************' |
CACHE_MIDDLEWARE_SECONDS | 600 |
CKEDITOR_BASEPATH | '/static/ckeditor/ckeditor/' |
CKEDITOR_CONFIGS | {'default': {'alignment': 'center', 'contentsCss': ['https://fonts.googleapis.com/css?family=Lalezar', '/static/stylesheet/fonts.css'], 'font_defaultLabel': 'Vazir', 'font_names': 'Lalezar; Vazir', 'toolbar': 'full', 'width': '100%'}} |
CKEDITOR_IMAGE_BACKEND | 'pillow' |
CKEDITOR_JQUERY_URL | 'https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js' |
CKEDITOR_UPLOAD_PATH | 'uploads/' |
CONSTANCE_SUPERUSER_ONLY | False |
CSRF_COOKIE_AGE | 31449600 |
CSRF_COOKIE_DOMAIN | None |
CSRF_COOKIE_HTTPONLY | True |
CSRF_COOKIE_NAME | 'csrftoken' |
CSRF_COOKIE_PATH | '/' |
CSRF_COOKIE_SAMESITE | 'Lax' |
CSRF_COOKIE_SECURE | True |
CSRF_FAILURE_VIEW | 'django.views.csrf.csrf_failure' |
CSRF_HEADER_NAME | 'HTTP_X_CSRFTOKEN' |
CSRF_TRUSTED_ORIGINS | [] |
CSRF_USE_SESSIONS | False |
DATABASES | {'default': {'ATOMIC_REQUESTS': False, 'AUTOCOMMIT': True, 'CONN_MAX_AGE': 0, 'ENGINE': 'django.db.backends.mysql', 'HOST': 'localhost', 'NAME': 'mrpyir_db', 'OPTIONS': {'charset': 'utf8mb4'}, 'PASSWORD': '********************', 'PORT': '3306', 'TEST': {'CHARSET': None, 'COLLATION': None, 'MIGRATE': True, 'MIRROR': None, 'NAME': None}, 'TIME_ZONE': None, 'USER': 'mrpyir_db'}} |
DATABASE_ROUTERS | [] |
DATA_UPLOAD_MAX_MEMORY_SIZE | 2621440 |
DATA_UPLOAD_MAX_NUMBER_FIELDS | 1000 |
DATETIME_FORMAT | 'N j, Y, P' |
DATETIME_INPUT_FORMATS | ['%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M:%S.%f', '%Y-%m-%d %H:%M', '%m/%d/%Y %H:%M:%S', '%m/%d/%Y %H:%M:%S.%f', '%m/%d/%Y %H:%M', '%m/%d/%y %H:%M:%S', '%m/%d/%y %H:%M:%S.%f', '%m/%d/%y %H:%M'] |
DATE_FORMAT | 'N j, Y' |
DATE_INPUT_FORMATS | ['%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', '%b %d %Y', '%b %d, %Y', '%d %b %Y', '%d %b, %Y', '%B %d %Y', '%B %d, %Y', '%d %B %Y', '%d %B, %Y'] |
DEBUG | True |
DEBUG_PROPAGATE_EXCEPTIONS | False |
DECIMAL_SEPARATOR | '.' |
DEFAULT_AUTO_FIELD | 'django.db.models.AutoField' |
DEFAULT_CHARSET | 'utf-8' |
DEFAULT_EXCEPTION_REPORTER | 'django.views.debug.ExceptionReporter' |
DEFAULT_EXCEPTION_REPORTER_FILTER | 'django.views.debug.SafeExceptionReporterFilter' |
DEFAULT_FILE_STORAGE | 'django.core.files.storage.FileSystemStorage' |
DEFAULT_FROM_EMAIL | 'webmaster@localhost' |
DEFAULT_HASHING_ALGORITHM | 'sha256' |
DEFAULT_INDEX_TABLESPACE | '' |
DEFAULT_TABLESPACE | '' |
DISALLOWED_USER_AGENTS | [] |
EMAIL_BACKEND | 'django.core.mail.backends.smtp.EmailBackend' |
EMAIL_HOST | 'mail.mrpy.ir' |
EMAIL_HOST_PASSWORD | '********************' |
EMAIL_HOST_USER | 'info@mrpy.ir' |
EMAIL_PORT | 587 |
EMAIL_SSL_CERTFILE | None |
EMAIL_SSL_KEYFILE | '********************' |
EMAIL_SUBJECT_PREFIX | '[Django] ' |
EMAIL_TIMEOUT | None |
EMAIL_USE_LOCALTIME | False |
EMAIL_USE_SSL | False |
EMAIL_USE_TLS | True |
FILE_UPLOAD_DIRECTORY_PERMISSIONS | None |
FILE_UPLOAD_HANDLERS | ['django.core.files.uploadhandler.MemoryFileUploadHandler', 'django.core.files.uploadhandler.TemporaryFileUploadHandler'] |
FILE_UPLOAD_MAX_MEMORY_SIZE | 2621440 |
FILE_UPLOAD_PERMISSIONS | 420 |
FILE_UPLOAD_TEMP_DIR | None |
FIRST_DAY_OF_WEEK | 0 |
FIXTURE_DIRS | [] |
FORCE_SCRIPT_NAME | None |
FORMAT_MODULE_PATH | None |
FORM_RENDERER | 'django.forms.renderers.DjangoTemplates' |
IGNORABLE_404_URLS | [] |
INSTALLED_APPS | ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'ckeditor', 'ckeditor_uploader', 'apps', 'programming_questions', 'accounts', 'course', 'question', 'tinymce', 'widget_tweaks', 'jalali_date', 'articles', 'crispy_forms', 'challenges', 'rest_framework', 'mathfilters', 'social_django', 'timeout_decorator'] |
INTERNAL_IPS | ['127.0.0.1'] |
JALALI_DATE_DEFAULTS | {'Static': {'css': {'all': ['admin/jquery.ui.datepicker.jalali/themes/base/jquery-ui.min.css']}, 'js': ['admin/js/django_jalali.min.js']}, 'Strftime': {'date': '%y/%m/%d', 'datetime': '%H:%M:%S _ %y/%m/%d'}} |
LANGUAGES | [('af', 'Afrikaans'), ('ar', 'Arabic'), ('ar-dz', 'Algerian Arabic'), ('ast', 'Asturian'), ('az', 'Azerbaijani'), ('bg', 'Bulgarian'), ('be', 'Belarusian'), ('bn', 'Bengali'), ('br', 'Breton'), ('bs', 'Bosnian'), ('ca', 'Catalan'), ('cs', 'Czech'), ('cy', 'Welsh'), ('da', 'Danish'), ('de', 'German'), ('dsb', 'Lower Sorbian'), ('el', 'Greek'), ('en', 'English'), ('en-au', 'Australian English'), ('en-gb', 'British English'), ('eo', 'Esperanto'), ('es', 'Spanish'), ('es-ar', 'Argentinian Spanish'), ('es-co', 'Colombian Spanish'), ('es-mx', 'Mexican Spanish'), ('es-ni', 'Nicaraguan Spanish'), ('es-ve', 'Venezuelan Spanish'), ('et', 'Estonian'), ('eu', 'Basque'), ('fa', 'Persian'), ('fi', 'Finnish'), ('fr', 'French'), ('fy', 'Frisian'), ('ga', 'Irish'), ('gd', 'Scottish Gaelic'), ('gl', 'Galician'), ('he', 'Hebrew'), ('hi', 'Hindi'), ('hr', 'Croatian'), ('hsb', 'Upper Sorbian'), ('hu', 'Hungarian'), ('hy', 'Armenian'), ('ia', 'Interlingua'), ('id', 'Indonesian'), ('ig', 'Igbo'), ('io', 'Ido'), ('is', 'Icelandic'), ('it', 'Italian'), ('ja', 'Japanese'), ('ka', 'Georgian'), ('kab', 'Kabyle'), ('kk', 'Kazakh'), ('km', 'Khmer'), ('kn', 'Kannada'), ('ko', 'Korean'), ('ky', 'Kyrgyz'), ('lb', 'Luxembourgish'), ('lt', 'Lithuanian'), ('lv', 'Latvian'), ('mk', 'Macedonian'), ('ml', 'Malayalam'), ('mn', 'Mongolian'), ('mr', 'Marathi'), ('my', 'Burmese'), ('nb', 'Norwegian Bokmål'), ('ne', 'Nepali'), ('nl', 'Dutch'), ('nn', 'Norwegian Nynorsk'), ('os', 'Ossetic'), ('pa', 'Punjabi'), ('pl', 'Polish'), ('pt', 'Portuguese'), ('pt-br', 'Brazilian Portuguese'), ('ro', 'Romanian'), ('ru', 'Russian'), ('sk', 'Slovak'), ('sl', 'Slovenian'), ('sq', 'Albanian'), ('sr', 'Serbian'), ('sr-latn', 'Serbian Latin'), ('sv', 'Swedish'), ('sw', 'Swahili'), ('ta', 'Tamil'), ('te', 'Telugu'), ('tg', 'Tajik'), ('th', 'Thai'), ('tk', 'Turkmen'), ('tr', 'Turkish'), ('tt', 'Tatar'), ('udm', 'Udmurt'), ('uk', 'Ukrainian'), ('ur', 'Urdu'), ('uz', 'Uzbek'), ('vi', 'Vietnamese'), ('zh-hans', 'Simplified Chinese'), ('zh-hant', 'Traditional Chinese')] |
LANGUAGES_BIDI | ['he', 'ar', 'ar-dz', 'fa', 'ur'] |
LANGUAGE_CODE | 'en-us' |
LANGUAGE_COOKIE_AGE | None |
LANGUAGE_COOKIE_DOMAIN | None |
LANGUAGE_COOKIE_HTTPONLY | False |
LANGUAGE_COOKIE_NAME | 'django_language' |
LANGUAGE_COOKIE_PATH | '/' |
LANGUAGE_COOKIE_SAMESITE | None |
LANGUAGE_COOKIE_SECURE | False |
LOCALE_PATHS | [] |
LOGGING | {} |
LOGGING_CONFIG | 'logging.config.dictConfig' |
LOGIN_REDIRECT_URL | '/' |
LOGIN_URL | '/auth/login/google-oauth2/' |
LOGOUT_REDIRECT_URL | None |
LOGOUT_URL | 'logout' |
MANAGERS | [] |
MEDIA_ROOT | '/home1/mrpyir/repositories/mrpy/media' |
MEDIA_URL | '/media/' |
MESSAGE_STORAGE | 'django.contrib.messages.storage.fallback.FallbackStorage' |
MIDDLEWARE | ['django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'social_django.middleware.SocialAuthExceptionMiddleware'] |
MIGRATION_MODULES | {} |
MONTH_DAY_FORMAT | 'F j' |
NUMBER_GROUPING | 0 |
PASSWORD_HASHERS | '********************' |
PASSWORD_RESET_TIMEOUT | '********************' |
PASSWORD_RESET_TIMEOUT_DAYS | '********************' |
PREPEND_WWW | False |
ROOT_URLCONF | 'config.urls' |
SECRET_KEY | '********************' |
SECURE_BROWSER_XSS_FILTER | False |
SECURE_CONTENT_TYPE_NOSNIFF | True |
SECURE_HSTS_INCLUDE_SUBDOMAINS | False |
SECURE_HSTS_PRELOAD | False |
SECURE_HSTS_SECONDS | 0 |
SECURE_PROXY_SSL_HEADER | ('HTTP_X_FORWARDED_PROTO', 'http') |
SECURE_REDIRECT_EXEMPT | [] |
SECURE_REFERRER_POLICY | 'same-origin' |
SECURE_SSL_HOST | None |
SECURE_SSL_REDIRECT | False |
SERVER_EMAIL | 'root@localhost' |
SESSION_CACHE_ALIAS | 'default' |
SESSION_COOKIE_AGE | 1209600 |
SESSION_COOKIE_DOMAIN | None |
SESSION_COOKIE_HTTPONLY | True |
SESSION_COOKIE_NAME | 'sessionid' |
SESSION_COOKIE_PATH | '/' |
SESSION_COOKIE_SAMESITE | 'Lax' |
SESSION_COOKIE_SECURE | True |
SESSION_ENGINE | 'django.contrib.sessions.backends.db' |
SESSION_EXPIRE_AT_BROWSER_CLOSE | False |
SESSION_FILE_PATH | None |
SESSION_SAVE_EVERY_REQUEST | False |
SESSION_SERIALIZER | 'django.contrib.sessions.serializers.JSONSerializer' |
SETTINGS_MODULE | 'config.settings' |
SHORT_DATETIME_FORMAT | 'm/d/Y P' |
SHORT_DATE_FORMAT | 'm/d/Y' |
SIGNING_BACKEND | 'django.core.signing.TimestampSigner' |
SILENCED_SYSTEM_CHECKS | [] |
SOCIAL_AUTH_GITHUB_KEY | '********************' |
SOCIAL_AUTH_GITHUB_SECRET | '********************' |
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY | '********************' |
SOCIAL_AUTH_GOOGLE_OAUTH2_SCOPE | ['https://www.googleapis.com/auth/userinfo.email', 'https://www.googleapis.com/auth/userinfo.profile'] |
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET | '********************' |
SOCIAL_AUTH_URL_NAMESPACE | 'social' |
STAR_RATINGS_ANONYMOUS | True |
STATICFILES_DIRS | [] |
STATICFILES_FINDERS | ['django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder'] |
STATICFILES_STORAGE | 'django.contrib.staticfiles.storage.StaticFilesStorage' |
STATIC_ROOT | '/home1/mrpyir/repositories/mrpy/static' |
STATIC_URL | '/static/' |
TEMPLATES | [{'APP_DIRS': True, 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': ['templates'], 'OPTIONS': {'context_processors': ['django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', 'apps.notifications.message_processor', 'apps.ip.get_ip', 'social_django.context_processors.backends', 'social_django.context_processors.login_redirect']}}] |
TEMPLATE_CONTEXT_PROCESSORS | ['django.core.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.core.context_processors.debug', 'django.core.context_processors.i18n', 'django.core.context_processors.request', 'django.core.context_processors.static', 'django.contrib.messages.context_processors.messages'] |
TEST_NON_SERIALIZED_APPS | [] |
TEST_RUNNER | 'django.test.runner.DiscoverRunner' |
THOUSAND_SEPARATOR | ',' |
TIME_FORMAT | 'P' |
TIME_INPUT_FORMATS | ['%H:%M:%S', '%H:%M:%S.%f', '%H:%M'] |
TIME_ZONE | 'Asia/Tehran' |
TINYMCE_DEFAULT_CONFIG | {'plugins': 'advlist,directionality,advlist,autolink,lists,link,image,imagetools,charmap,print,preview,anchor,searchreplace,visualblocks,code,fullscreen,insertdatetime,media,table,paste,searchreplace,visualblocks,code,fullscreen,insertdatetime,help', 'toolbar': 'undo redo | formatselect | image | rtl ltr', 'width': '100%'} |
USE_I18N | True |
USE_L10N | True |
USE_THOUSAND_SEPARATOR | False |
USE_TZ | True |
USE_X_FORWARDED_HOST | False |
USE_X_FORWARDED_PORT | False |
WSGI_APPLICATION | 'config.wsgi.application' |
X_FRAME_OPTIONS | 'DENY' |
YEAR_MONTH_FORMAT | 'F Y' |
You’re seeing this error because you have DEBUG = True
in your
Django settings file. Change that to False
, and Django will
display a standard page generated by the handler for this status code.