Field 'id' expected a number but got 'gallery'.
Request Method: | GET |
---|---|
Request URL: | https://nuga.com.ng/newsdetails/gallery |
Django Version: | 4.1.6 |
Exception Type: | ValueError |
Exception Value: | Field 'id' expected a number but got 'gallery'. |
Exception Location: | /nugasite/venv/lib/python3.10/site-packages/django/db/models/fields/__init__.py, line 2020, in get_prep_value |
Raised during: | nugamain.views.newsdetails |
Python Executable: | /nugasite/venv/bin/python |
Python Version: | 3.10.6 |
Python Path: | ['/nugasite/src', '/usr/lib/python310.zip', '/usr/lib/python3.10', '/usr/lib/python3.10/lib-dynload', '/nugasite/venv/lib/python3.10/site-packages'] |
Server time: | Fri, 29 Mar 2024 04:57:13 +0000 |
/nugasite/venv/lib/python3.10/site-packages/django/db/models/fields/__init__.py
, line 2018, 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 | 'gallery' |
/nugasite/venv/lib/python3.10/site-packages/django/core/handlers/exception.py
, line 55, in inner
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 | ValueError("Field 'id' expected a number but got 'gallery'.") |
get_response | <bound method BaseHandler._get_response of <django.core.handlers.wsgi.WSGIHandler object at 0x7ffbaf092e60>> |
request | <WSGIRequest: GET '/newsdetails/gallery'> |
/nugasite/venv/lib/python3.10/site-packages/django/core/handlers/base.py
, line 197, 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 newsdetails at 0x7ffbae35db40> |
callback_args | () |
callback_kwargs | {'id': 'gallery'} |
middleware_method | <bound method CsrfViewMiddleware.process_view of <CsrfViewMiddleware get_response=convert_exception_to_response.<locals>.inner>> |
request | <WSGIRequest: GET '/newsdetails/gallery'> |
response | None |
self | <django.core.handlers.wsgi.WSGIHandler object at 0x7ffbaf092e60> |
wrapped_callback | <function newsdetails at 0x7ffbae35db40> |
/nugasite/src/nugamain/views.py
, line 34, in newsdetails
context = {"title":title, "news_list":news_list,"events": events}
return render(request, "contacts.html", context)
def newsdetails(request, id):
title = "News Detail"
events = Events.objects.all()
news_list = News.objects.all().order_by('-id')[:6]
newsitem = News.objects.get(id=id)…
#ntitle = newstitle .get('title')
#newcontent = News.objects.values('title').get(id=id)
#ncontent = newcontent .get('title')
context = {"title":title, "newsitem":newsitem , "news_list":news_list,"events": events}
Variable | Value |
---|---|
events | <QuerySet [<Events: Events object (1)>, <Events: Events object (2)>, <Events: Events object (3)>]> |
id | 'gallery' |
news_list | <QuerySet [<News: CALL FOR APPLICATION NUGA_FISU STUDENT AMBASSADOR>, <News: LAGOS TO HOST 11TH AFRICAN UNIVERSITY GAMES FROM SEPTEMBER 20–29, 2024>, <News: NUGA MOURNS THE PASSING OF MR. EMEKA OGBU, ESTEEMED PRESIDENT>, <News: NIGERIAN UNIVERSITY GAMES ASSOCIATION (NUGA) AND GAMR COLLABORATE TO ELEVATE ESPORTS IN NIGERIAN UNIVERSITIES>, <News: Nigerian Universities Celebrate the 2023 International Day of University Sports with a Focus on a Drug-Free Campus>, <News: "Former FISU Ambassador, Adebayo Olatunde, Pens Open Letter to NUGA as His Tenure Ends">]> |
request | <WSGIRequest: GET '/newsdetails/gallery'> |
title | 'News Detail' |
/nugasite/venv/lib/python3.10/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 = {}
Variable | Value |
---|---|
args | () |
kwargs | {'id': 'gallery'} |
name | 'get' |
self | <django.db.models.manager.Manager object at 0x7ffbae0c6fe0> |
/nugasite/venv/lib/python3.10/site-packages/django/db/models/query.py
, line 636, in get
keyword arguments.
"""
if self.query.combinator and (args or kwargs):
raise NotSupportedError(
"Calling QuerySet.get(...) with filters after %s() is not "
"supported." % self.query.combinator
)
clone = self._chain() if self.query.combinator else self.filter(*args, **kwargs)…
if self.query.can_filter() and not self.query.distinct_fields:
clone = clone.order_by()
limit = None
if (
not clone.query.select_for_update
or connections[clone.db].features.supports_select_for_update_with_limit
Variable | Value |
---|---|
args | () |
kwargs | {'id': 'gallery'} |
self | <QuerySet [<News: CALL FOR APPLICATION NUGA_FISU STUDENT AMBASSADOR>, <News: LAGOS TO HOST 11TH AFRICAN UNIVERSITY GAMES FROM SEPTEMBER 20–29, 2024>, <News: NUGA MOURNS THE PASSING OF MR. EMEKA OGBU, ESTEEMED PRESIDENT>, <News: NIGERIAN UNIVERSITY GAMES ASSOCIATION (NUGA) AND GAMR COLLABORATE TO ELEVATE ESPORTS IN NIGERIAN UNIVERSITIES>, <News: Nigerian Universities Celebrate the 2023 International Day of University Sports with a Focus on a Drug-Free Campus>, <News: "Former FISU Ambassador, Adebayo Olatunde, Pens Open Letter to NUGA as His Tenure Ends">, <News: Embracing Unity and Excellence: The Nigerian Delegation at the 31st World University Games in Chengdu, China>, <News: Team Nigeria steals the show at World University Games opening ceremony with Davido's Unavailable>, <News: The Nigeria Drug Enforcement Agency (NDLEA) partners with NUGA to combat drug use among youth through sports.>, <News: Nigeria Journalist, 11 others selected for FISU Young Reporters Programme in China>, <News: NUGA CONCLUDES TRIALS FOR WORLD UNIVERSITY GAMES>, <News: 315 ATHLETES TO COMPETE AT NUGA WORLD UNIVERSITY GAMES TRIALS IN BENIN CITY, EDO STATE>, <News: GOVERNMENT OF EDO STATE AND UNIVERSITY OF BENIN TO HOST 2023 NUGA TRIALS FOR WORLD UNIVERSITY GAMES>, <News: Want to cover the Chengdu 2023 FISU Games? Register here!>, <News: FUTA holds 9th edition of the Awopegba Football Tournamen>, <News: Application for Young Reporters Programme at Chengdu 2021 FISU Games ends April 14>, <News: 100 Athletes to Represent Nigeria at World University Games in Chengdu, China>, <News: JAMB Registrar Agrees To Support NUGA's Ambition For The 2023 World University Games; Commits to Sports Development in Nigerian Universities>, <News: Imade Osenhenkhoe: From HIFL Scorer, To A Topflight League Scorer>, <News: Join the NUGA Alumni Network>, '...(remaining elements truncated)...']> |
/nugasite/venv/lib/python3.10/site-packages/django/db/models/query.py
, line 1421, 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 | {'id': 'gallery'} |
self | <QuerySet [<News: CALL FOR APPLICATION NUGA_FISU STUDENT AMBASSADOR>, <News: LAGOS TO HOST 11TH AFRICAN UNIVERSITY GAMES FROM SEPTEMBER 20–29, 2024>, <News: NUGA MOURNS THE PASSING OF MR. EMEKA OGBU, ESTEEMED PRESIDENT>, <News: NIGERIAN UNIVERSITY GAMES ASSOCIATION (NUGA) AND GAMR COLLABORATE TO ELEVATE ESPORTS IN NIGERIAN UNIVERSITIES>, <News: Nigerian Universities Celebrate the 2023 International Day of University Sports with a Focus on a Drug-Free Campus>, <News: "Former FISU Ambassador, Adebayo Olatunde, Pens Open Letter to NUGA as His Tenure Ends">, <News: Embracing Unity and Excellence: The Nigerian Delegation at the 31st World University Games in Chengdu, China>, <News: Team Nigeria steals the show at World University Games opening ceremony with Davido's Unavailable>, <News: The Nigeria Drug Enforcement Agency (NDLEA) partners with NUGA to combat drug use among youth through sports.>, <News: Nigeria Journalist, 11 others selected for FISU Young Reporters Programme in China>, <News: NUGA CONCLUDES TRIALS FOR WORLD UNIVERSITY GAMES>, <News: 315 ATHLETES TO COMPETE AT NUGA WORLD UNIVERSITY GAMES TRIALS IN BENIN CITY, EDO STATE>, <News: GOVERNMENT OF EDO STATE AND UNIVERSITY OF BENIN TO HOST 2023 NUGA TRIALS FOR WORLD UNIVERSITY GAMES>, <News: Want to cover the Chengdu 2023 FISU Games? Register here!>, <News: FUTA holds 9th edition of the Awopegba Football Tournamen>, <News: Application for Young Reporters Programme at Chengdu 2021 FISU Games ends April 14>, <News: 100 Athletes to Represent Nigeria at World University Games in Chengdu, China>, <News: JAMB Registrar Agrees To Support NUGA's Ambition For The 2023 World University Games; Commits to Sports Development in Nigerian Universities>, <News: Imade Osenhenkhoe: From HIFL Scorer, To A Topflight League Scorer>, <News: Join the NUGA Alumni Network>, '...(remaining elements truncated)...']> |
/nugasite/venv/lib/python3.10/site-packages/django/db/models/query.py
, line 1439, in _filter_or_exclude
if (args or kwargs) and self.query.is_sliced:
raise TypeError("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 [<News: CALL FOR APPLICATION NUGA_FISU STUDENT AMBASSADOR>, <News: LAGOS TO HOST 11TH AFRICAN UNIVERSITY GAMES FROM SEPTEMBER 20–29, 2024>, <News: NUGA MOURNS THE PASSING OF MR. EMEKA OGBU, ESTEEMED PRESIDENT>, <News: NIGERIAN UNIVERSITY GAMES ASSOCIATION (NUGA) AND GAMR COLLABORATE TO ELEVATE ESPORTS IN NIGERIAN UNIVERSITIES>, <News: Nigerian Universities Celebrate the 2023 International Day of University Sports with a Focus on a Drug-Free Campus>, <News: "Former FISU Ambassador, Adebayo Olatunde, Pens Open Letter to NUGA as His Tenure Ends">, <News: Embracing Unity and Excellence: The Nigerian Delegation at the 31st World University Games in Chengdu, China>, <News: Team Nigeria steals the show at World University Games opening ceremony with Davido's Unavailable>, <News: The Nigeria Drug Enforcement Agency (NDLEA) partners with NUGA to combat drug use among youth through sports.>, <News: Nigeria Journalist, 11 others selected for FISU Young Reporters Programme in China>, <News: NUGA CONCLUDES TRIALS FOR WORLD UNIVERSITY GAMES>, <News: 315 ATHLETES TO COMPETE AT NUGA WORLD UNIVERSITY GAMES TRIALS IN BENIN CITY, EDO STATE>, <News: GOVERNMENT OF EDO STATE AND UNIVERSITY OF BENIN TO HOST 2023 NUGA TRIALS FOR WORLD UNIVERSITY GAMES>, <News: Want to cover the Chengdu 2023 FISU Games? Register here!>, <News: FUTA holds 9th edition of the Awopegba Football Tournamen>, <News: Application for Young Reporters Programme at Chengdu 2021 FISU Games ends April 14>, <News: 100 Athletes to Represent Nigeria at World University Games in Chengdu, China>, <News: JAMB Registrar Agrees To Support NUGA's Ambition For The 2023 World University Games; Commits to Sports Development in Nigerian Universities>, <News: Imade Osenhenkhoe: From HIFL Scorer, To A Topflight League Scorer>, <News: Join the NUGA Alumni Network>, '...(remaining elements truncated)...']> |
kwargs | {'id': 'gallery'} |
negate | False |
self | <QuerySet [<News: CALL FOR APPLICATION NUGA_FISU STUDENT AMBASSADOR>, <News: LAGOS TO HOST 11TH AFRICAN UNIVERSITY GAMES FROM SEPTEMBER 20–29, 2024>, <News: NUGA MOURNS THE PASSING OF MR. EMEKA OGBU, ESTEEMED PRESIDENT>, <News: NIGERIAN UNIVERSITY GAMES ASSOCIATION (NUGA) AND GAMR COLLABORATE TO ELEVATE ESPORTS IN NIGERIAN UNIVERSITIES>, <News: Nigerian Universities Celebrate the 2023 International Day of University Sports with a Focus on a Drug-Free Campus>, <News: "Former FISU Ambassador, Adebayo Olatunde, Pens Open Letter to NUGA as His Tenure Ends">, <News: Embracing Unity and Excellence: The Nigerian Delegation at the 31st World University Games in Chengdu, China>, <News: Team Nigeria steals the show at World University Games opening ceremony with Davido's Unavailable>, <News: The Nigeria Drug Enforcement Agency (NDLEA) partners with NUGA to combat drug use among youth through sports.>, <News: Nigeria Journalist, 11 others selected for FISU Young Reporters Programme in China>, <News: NUGA CONCLUDES TRIALS FOR WORLD UNIVERSITY GAMES>, <News: 315 ATHLETES TO COMPETE AT NUGA WORLD UNIVERSITY GAMES TRIALS IN BENIN CITY, EDO STATE>, <News: GOVERNMENT OF EDO STATE AND UNIVERSITY OF BENIN TO HOST 2023 NUGA TRIALS FOR WORLD UNIVERSITY GAMES>, <News: Want to cover the Chengdu 2023 FISU Games? Register here!>, <News: FUTA holds 9th edition of the Awopegba Football Tournamen>, <News: Application for Young Reporters Programme at Chengdu 2021 FISU Games ends April 14>, <News: 100 Athletes to Represent Nigeria at World University Games in Chengdu, China>, <News: JAMB Registrar Agrees To Support NUGA's Ambition For The 2023 World University Games; Commits to Sports Development in Nigerian Universities>, <News: Imade Osenhenkhoe: From HIFL Scorer, To A Topflight League Scorer>, <News: Join the NUGA Alumni Network>, '...(remaining elements truncated)...']> |
/nugasite/venv/lib/python3.10/site-packages/django/db/models/query.py
, line 1446, 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 | {'id': 'gallery'} |
negate | False |
self | <QuerySet [<News: CALL FOR APPLICATION NUGA_FISU STUDENT AMBASSADOR>, <News: LAGOS TO HOST 11TH AFRICAN UNIVERSITY GAMES FROM SEPTEMBER 20–29, 2024>, <News: NUGA MOURNS THE PASSING OF MR. EMEKA OGBU, ESTEEMED PRESIDENT>, <News: NIGERIAN UNIVERSITY GAMES ASSOCIATION (NUGA) AND GAMR COLLABORATE TO ELEVATE ESPORTS IN NIGERIAN UNIVERSITIES>, <News: Nigerian Universities Celebrate the 2023 International Day of University Sports with a Focus on a Drug-Free Campus>, <News: "Former FISU Ambassador, Adebayo Olatunde, Pens Open Letter to NUGA as His Tenure Ends">, <News: Embracing Unity and Excellence: The Nigerian Delegation at the 31st World University Games in Chengdu, China>, <News: Team Nigeria steals the show at World University Games opening ceremony with Davido's Unavailable>, <News: The Nigeria Drug Enforcement Agency (NDLEA) partners with NUGA to combat drug use among youth through sports.>, <News: Nigeria Journalist, 11 others selected for FISU Young Reporters Programme in China>, <News: NUGA CONCLUDES TRIALS FOR WORLD UNIVERSITY GAMES>, <News: 315 ATHLETES TO COMPETE AT NUGA WORLD UNIVERSITY GAMES TRIALS IN BENIN CITY, EDO STATE>, <News: GOVERNMENT OF EDO STATE AND UNIVERSITY OF BENIN TO HOST 2023 NUGA TRIALS FOR WORLD UNIVERSITY GAMES>, <News: Want to cover the Chengdu 2023 FISU Games? Register here!>, <News: FUTA holds 9th edition of the Awopegba Football Tournamen>, <News: Application for Young Reporters Programme at Chengdu 2021 FISU Games ends April 14>, <News: 100 Athletes to Represent Nigeria at World University Games in Chengdu, China>, <News: JAMB Registrar Agrees To Support NUGA's Ambition For The 2023 World University Games; Commits to Sports Development in Nigerian Universities>, <News: Imade Osenhenkhoe: From HIFL Scorer, To A Topflight League Scorer>, <News: Join the NUGA Alumni Network>, '...(remaining elements truncated)...']> |
/nugasite/venv/lib/python3.10/site-packages/django/db/models/sql/query.py
, line 1532, in add_q
# 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: ('id', 'gallery'))> |
self | <django.db.models.sql.query.Query object at 0x7ffbae063d30> |
/nugasite/venv/lib/python3.10/site-packages/django/db/models/sql/query.py
, line 1562, in _add_q
current_negated = current_negated ^ q_object.negated
branch_negated = branch_negated or q_object.negated
target_clause = WhereNode(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,
Variable | Value |
---|---|
allow_joins | True |
branch_negated | False |
check_filterable | True |
child | ('id', 'gallery') |
connector | 'AND' |
current_negated | False |
joinpromoter | JoinPromoter(connector='AND', num_children=1, negated=False) |
q_object | <Q: (AND: ('id', 'gallery'))> |
self | <django.db.models.sql.query.Query object at 0x7ffbae063d30> |
split_subq | True |
target_clause | <WhereNode: (AND: )> |
used_aliases | {'news'} |
/nugasite/venv/lib/python3.10/site-packages/django/db/models/sql/query.py
, line 1478, in build_filter
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 = WhereNode([condition], connector=AND)
require_outer = (
lookup_type == "isnull" and condition.rhs is True and not current_negated
)
Variable | Value |
---|---|
alias | 'news' |
allow_joins | True |
allow_many | True |
arg | 'id' |
branch_negated | False |
can_reuse | {'news'} |
check_filterable | True |
col | Col(news, nugamain.News.id) |
current_negated | False |
filter_expr | ('id', 'gallery') |
join_info | JoinInfo(final_field=<django.db.models.fields.BigAutoField: id>, targets=(<django.db.models.fields.BigAutoField: id>,), opts=<Options for News>, joins=['news'], path=[], transform_function=<function Query.setup_joins.<locals>.final_transformer at 0x7ffbade3ed40>) |
join_list | ['news'] |
lookups | [] |
opts | <Options for News> |
parts | ['id'] |
pre_joins | {} |
reffed_expression | False |
reuse_with_filtered_relation | False |
self | <django.db.models.sql.query.Query object at 0x7ffbae063d30> |
split_subq | True |
targets | (<django.db.models.fields.BigAutoField: id>,) |
used_joins | {'news'} |
value | 'gallery' |
/nugasite/venv/lib/python3.10/site-packages/django/db/models/sql/query.py
, line 1303, 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(news, nugamain.News.id) |
lookup_class | <class 'django.db.models.lookups.Exact'> |
lookup_name | 'exact' |
lookups | [] |
rhs | 'gallery' |
self | <django.db.models.sql.query.Query object at 0x7ffbae063d30> |
transforms | [] |
/nugasite/venv/lib/python3.10/site-packages/django/db/models/lookups.py
, line 27, in __init__
class Lookup(Expression):
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()…
self.lhs = self.get_prep_lhs()
if hasattr(self.lhs, "get_bilateral_transforms"):
bilateral_transforms = self.lhs.get_bilateral_transforms()
else:
bilateral_transforms = []
if bilateral_transforms:
Variable | Value |
---|---|
lhs | Col(news, nugamain.News.id) |
rhs | 'gallery' |
self | Exact(Col(news, nugamain.News.id), 'gallery') |
/nugasite/venv/lib/python3.10/site-packages/django/db/models/lookups.py
, line 341, in get_prep_lookup
self.rhs.clear_select_clause()
self.rhs.add_fields(["pk"])
else:
raise ValueError(
"The QuerySet value for an exact lookup must be limited to "
"one result using slicing."
)
return super().get_prep_lookup()…
def as_sql(self, compiler, connection):
# Avoid comparison against direct rhs if lhs is a boolean value. That
# turns "boolfield__exact=True" into "WHERE boolean_field" instead of
# "WHERE boolean_field = True" when allowed.
if (
Variable | Value |
---|---|
Query | <class 'django.db.models.sql.query.Query'> |
__class__ | <class 'django.db.models.lookups.Exact'> |
self | Exact(Col(news, nugamain.News.id), 'gallery') |
/nugasite/venv/lib/python3.10/site-packages/django/db/models/lookups.py
, line 85, in get_prep_lookup
self.lhs, self.rhs = new_exprs
def get_prep_lookup(self):
if not self.prepare_rhs or hasattr(self.rhs, "resolve_expression"):
return self.rhs
if hasattr(self.lhs, "output_field"):
if hasattr(self.lhs.output_field, "get_prep_value"):
return self.lhs.output_field.get_prep_value(self.rhs)…
elif self.rhs_is_direct_value():
return Value(self.rhs)
return self.rhs
def get_prep_lhs(self):
if hasattr(self.lhs, "resolve_expression"):
Variable | Value |
---|---|
self | Exact(Col(news, nugamain.News.id), 'gallery') |
/nugasite/venv/lib/python3.10/site-packages/django/db/models/fields/__init__.py
, line 2020, in get_prep_value
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):
return "IntegerField"
Variable | Value |
---|---|
__class__ | <class 'django.db.models.fields.IntegerField'> |
self | <django.db.models.fields.BigAutoField: id> |
value | 'gallery' |
AnonymousUser
No GET data
No POST data
No FILES data
No cookie data
Variable | Value |
---|---|
CONTEXT_DOCUMENT_ROOT | '/var/www/html' |
CONTEXT_PREFIX | '' |
DOCUMENT_ROOT | '/var/www/html' |
GATEWAY_INTERFACE | 'CGI/1.1' |
HTTP_ACCEPT | '*/*' |
HTTP_HOST | 'nuga.com.ng' |
HTTP_USER_AGENT | 'claudebot' |
PATH_INFO | '/newsdetails/gallery' |
PATH_TRANSLATED | '/nugasite/src/website/wsgi.py/newsdetails/gallery' |
QUERY_STRING | '' |
REMOTE_ADDR | '54.226.68.181' |
REMOTE_PORT | '42136' |
REQUEST_METHOD | 'GET' |
REQUEST_SCHEME | 'https' |
REQUEST_URI | '/newsdetails/gallery' |
SCRIPT_FILENAME | '/nugasite/src/website/wsgi.py' |
SCRIPT_NAME | '' |
SERVER_ADDR | '102.130.121.243' |
SERVER_ADMIN | 'admin@nuga.com.ng' |
SERVER_NAME | 'nuga.com.ng' |
SERVER_PORT | '443' |
SERVER_PROTOCOL | 'HTTP/1.1' |
SERVER_SIGNATURE | '********************' |
SERVER_SOFTWARE | 'Apache/2.4.52 (Ubuntu)' |
SSL_TLS_SNI | 'nuga.com.ng' |
apache.version | (2, 4, 52) |
mod_wsgi.application_group | 'nuga.com.ng|' |
mod_wsgi.callable_object | 'application' |
mod_wsgi.daemon_connects | '1' |
mod_wsgi.daemon_restarts | '0' |
mod_wsgi.daemon_start | '1711688233241272' |
mod_wsgi.enable_sendfile | '0' |
mod_wsgi.handler_script | '' |
mod_wsgi.ignore_activity | '0' |
mod_wsgi.listener_host | '' |
mod_wsgi.listener_port | '443' |
mod_wsgi.path_info | '/newsdetails/gallery' |
mod_wsgi.process_group | 'website' |
mod_wsgi.queue_start | '1711688233241184' |
mod_wsgi.request_handler | 'wsgi-script' |
mod_wsgi.request_id | '7ckbec2S+KA' |
mod_wsgi.request_start | '1711688233241069' |
mod_wsgi.script_name | '' |
mod_wsgi.script_reloading | '1' |
mod_wsgi.script_start | '1711688233241407' |
mod_wsgi.thread_id | 4 |
mod_wsgi.thread_requests | 321 |
mod_wsgi.total_requests | 918 |
mod_wsgi.version | (4, 9, 0) |
wsgi.errors | <_io.TextIOWrapper name='<wsgi.errors>' encoding='utf-8'> |
wsgi.file_wrapper | <class 'mod_wsgi.FileWrapper'> |
wsgi.input | <mod_wsgi.Input object at 0x7ffbadfab6e0> |
wsgi.input_terminated | True |
wsgi.multiprocess | False |
wsgi.multithread | True |
wsgi.run_once | False |
wsgi.url_scheme | 'https' |
wsgi.version | (1, 0) |
website.settings
Setting | Value |
---|---|
ABSOLUTE_URL_OVERRIDES | {} |
ADMINS | [] |
ALLOWED_HOSTS | ['nuga.com.ng', 'www.nuga.com.ng'] |
APPEND_SLASH | True |
AUTHENTICATION_BACKENDS | ['django.contrib.auth.backends.ModelBackend'] |
AUTH_PASSWORD_VALIDATORS | '********************' |
AUTH_USER_MODEL | 'auth.User' |
BASE_DIR | PosixPath('/nugasite/src') |
CACHES | {'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}} |
CACHE_MIDDLEWARE_ALIAS | 'default' |
CACHE_MIDDLEWARE_KEY_PREFIX | '********************' |
CACHE_MIDDLEWARE_SECONDS | 600 |
CSRF_COOKIE_AGE | 31449600 |
CSRF_COOKIE_DOMAIN | None |
CSRF_COOKIE_HTTPONLY | False |
CSRF_COOKIE_MASKED | False |
CSRF_COOKIE_NAME | 'csrftoken' |
CSRF_COOKIE_PATH | '/' |
CSRF_COOKIE_SAMESITE | 'Lax' |
CSRF_COOKIE_SECURE | False |
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_HEALTH_CHECKS': False, 'CONN_MAX_AGE': 0, 'ENGINE': 'django.db.backends.mysql', 'HOST': 'localhost', 'NAME': 'nugagames', 'OPTIONS': {}, 'PASSWORD': '********************', 'PORT': '3306', 'TEST': {'CHARSET': None, 'COLLATION': None, 'MIGRATE': True, 'MIRROR': None, 'NAME': None}, 'TIME_ZONE': None, 'USER': 'root'}} |
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.BigAutoField' |
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_INDEX_TABLESPACE | '' |
DEFAULT_TABLESPACE | '' |
DISALLOWED_USER_AGENTS | [] |
EMAIL_BACKEND | 'django.core.mail.backends.smtp.EmailBackend' |
EMAIL_HOST | 'localhost' |
EMAIL_HOST_PASSWORD | '********************' |
EMAIL_HOST_USER | '' |
EMAIL_PORT | 25 |
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 | False |
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', 'nugamain'] |
INTERNAL_IPS | [] |
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'), ('ms', 'Malay'), ('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 | '/accounts/profile/' |
LOGIN_URL | '/accounts/login/' |
LOGOUT_REDIRECT_URL | None |
MANAGERS | [] |
MEDIA_ROOT | '/nugasite/site/public/media' |
MEDIA_URL | '/media/' |
MESSAGE_STORAGE | 'django.contrib.messages.storage.fallback.FallbackStorage' |
MIDDLEWARE | ['django.middleware.security.SecurityMiddleware', 'whitenoise.middleware.WhiteNoiseMiddleware', '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'] |
MIGRATION_MODULES | {} |
MONTH_DAY_FORMAT | 'F j' |
NUMBER_GROUPING | 0 |
PASSWORD_HASHERS | '********************' |
PASSWORD_RESET_TIMEOUT | '********************' |
PREPEND_WWW | False |
ROOT_URLCONF | 'website.urls' |
SECRET_KEY | '********************' |
SECRET_KEY_FALLBACKS | '********************' |
SECURE_CONTENT_TYPE_NOSNIFF | True |
SECURE_CROSS_ORIGIN_OPENER_POLICY | 'same-origin' |
SECURE_HSTS_INCLUDE_SUBDOMAINS | False |
SECURE_HSTS_PRELOAD | False |
SECURE_HSTS_SECONDS | 0 |
SECURE_PROXY_SSL_HEADER | None |
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 | False |
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 | 'website.settings' |
SHORT_DATETIME_FORMAT | 'm/d/Y P' |
SHORT_DATE_FORMAT | 'm/d/Y' |
SIGNING_BACKEND | 'django.core.signing.TimestampSigner' |
SILENCED_SYSTEM_CHECKS | [] |
STATICFILES_DIRS | [] |
STATICFILES_FINDERS | ['django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder'] |
STATICFILES_STORAGE | 'whitenoise.storage.CompressedManifestStaticFilesStorage' |
STATIC_ROOT | '/nugasite/site/public/static' |
STATIC_URL | '/static/' |
TEMPLATES | [{'APP_DIRS': True, 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [PosixPath('/nugasite/src/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']}}] |
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 | 'UTC' |
USE_DEPRECATED_PYTZ | False |
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 | 'website.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.