#17034: 'Invalid literal for int' using admin site called with invalid
parameters
for inherited models
-------------------------------+--------------------
Reporter: ralphje | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.3
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
When using the admin site, gibberish can be entered as the lookup
parameter, at least with the change_view and the delete_view, which causes
an error. The trace that is sent to me is as follows:
{{{
ERROR (internal IP): Internal Server Error:
/admin/customers/customer/blahblah/
Traceback (most recent call last):
File "/...../django-1.3/django/core/handlers/base.py", line 111, in
get_response
response = callback(request, *callback_args, **callback_kwargs)
File "/...../django-1.3/django/contrib/admin/options.py", line 307, in
wrapper
return self.admin_site.admin_view(view)(*args, **kwargs)
File "/...../django-1.3/django/utils/decorators.py", line 93, in
_wrapped_view
response = view_func(request, *args, **kwargs)
File "/...../django-1.3/django/views/decorators/cache.py", line 79, in
_wrapped_view_func
response = view_func(request, *args, **kwargs)
File "/...../django-1.3/django/contrib/admin/sites.py", line 197, in
inner
return view(request, *args, **kwargs)
File "/...../django-1.3/django/utils/decorators.py", line 28, in _wrapper
return bound_func(*args, **kwargs)
File "/...../django-1.3/django/utils/decorators.py", line 93, in
_wrapped_view
response = view_func(request, *args, **kwargs)
File "/...../django-1.3/django/utils/decorators.py", line 24, in
bound_func
return func(self, *args2, **kwargs2)
File "/...../django-1.3/django/db/transaction.py", line 217, in inner
res = func(*args, **kwargs)
File "/...../django-1.3/django/contrib/admin/options.py", line 947, in
change_view
obj = self.get_object(request, unquote(object_id))
File "/...../django-1.3/django/contrib/admin/options.py", line 451, in
get_object
return queryset.get(pk=object_id)
File "/...../django-1.3/django/db/models/query.py", line 341, in get
clone = self.filter(*args, **kwargs)
File "/...../django-1.3/django/db/models/query.py", line 550, in filter
return self._filter_or_exclude(False, *args, **kwargs)
File "/...../django-1.3/django/db/models/query.py", line 568, in
_filter_or_exclude
clone.query.add_q(Q(*args, **kwargs))
File "/...../django-1.3/django/db/models/sql/query.py", line 1194, in
add_q
can_reuse=used_aliases, force_having=force_having)
File "/...../django-1.3/django/db/models/sql/query.py", line 1129, in
add_filter
connector)
File "/...../django-1.3/django/db/models/sql/where.py", line 67, in add
value = obj.prepare(lookup_type, value)
File "/...../django-1.3/django/db/models/sql/where.py", line 316, in
prepare
return self.field.get_prep_lookup(lookup_type, value)
File "/...../django-1.3/django/db/models/fields/related.py", line 136, in
get_prep_lookup
return self._pk_trace(value, 'get_prep_lookup', lookup_type)
File "/...../django-1.3/django/db/models/fields/related.py", line 209, in
_pk_trace
v = getattr(field, prep_func)(lookup_type, v, **kwargs)
File "/...../django-1.3/django/db/models/fields/__init__.py", line 292,
in get_prep_lookup
return self.get_prep_value(value)
File "/...../django-1.3/django/db/models/fields/__init__.py", line 479,
in get_prep_value
return int(value)
ValueError: invalid literal for int() with base 10: 'blahblah'
}}}
It seems that this error only occurs when using a inherited object. The
Customer object in my project is defined as follows:
{{{
class Customer(Contact):
language = models.CharField(_('language'), max_length=5,
choices=languages, default='nl')
(etc)
objects = ContactManager()
}}}
Other inherited objects seem to have the same issue.
This issue is quite low-priority, as only the admin site is affected and
this only results in error mails to be sent when an user fails with its
url. It's not a security leak.
--
Ticket URL: <https://code.djangoproject.com/ticket/17034>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.