Strange ValueError in Safari on iOS

14 views
Skip to first unread message

Mike Dewhirst

unread,
Oct 1, 2021, 8:47:46 PM10/1/21
to Django users
In the error message below that "icon-yes.svg" is named in
django/contrib/admin/static/admin/css/base.css

ul.messagelist li {
    display: block;
    font-weight: 400;
    font-size: 13px;
    padding: 10px 10px 10px 65px;
    margin: 0 0 10px 0;
    background: var(--message-success-bg) url(../img/icon-yes.svg) 40px
12px no-repeat;
    background-size: 16px auto;
    color: var(--body-fg);
}

I haven't seen the error with Mozilla Firefox or Google Chrome so I'm
guessing it is something to do with Apple and treatment of trailing slashes.

my setting is APPEND_SLASH = True which was set after much trial and
error long ago so I'm not keen to try and remember all that experiment
with it again.

Thanks for any help

Cheers

Mike


ValueError at /admin/chemical/chemical/29/img/icon-yes.svg/change/

Field 'id' expected a number but got '29/img/icon-yes.svg'.

Request Method: GET
Request URL:
https://xxxxxxx.xxx/admin/chemical/chemical/29/img/icon-yes.svg/change/
Django Version: 3.2.7
Exception Type: ValueError
Exception Value:

Field 'id' expected a number but got '29/img/icon-yes.svg'.

Exception Location:
/usr/local/lib/python3.6/dist-packages/django/db/models/fields/__init__.py,
line 1827, in get_prep_value
Python Executable: /usr/bin/python3
Python Version: 3.6.9



--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.


OpenPGP_signature

David Nugent

unread,
Oct 1, 2021, 10:31:42 PM10/1/21
to django...@googlegroups.com

I have some doubt the admin css is related.  The css file should provide a path to the image file, relative to its own location in this case - both the css and svg file will be served via whatever is handling your static files (usually an external like nginx etc if in production mode, else by your staticfiles finders in development mode). Django won't be involved in any of that, it is purely a browser/staticfiles exchange.

Is something else is generating the  `/admin/chemical/chemical/29/img/icon-yes.svg/change/` URL in your admin?  It is possible that the filename may be a coincidence.

HTH, David


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0e7c9731-18bc-f119-f83b-617c1709cff7%40dewhirst.com.au.

Mike Dewhirst

unread,
Oct 2, 2021, 12:19:44 AM10/2/21
to django...@googlegroups.com
David

Thank you for responding. That part of the code is - I think - beyond my control. It occurs after saving a record and during display of the success message in the admin change form.

That particular svg is the image which gets included in the success message.

The same code works perfectly - or at least without error - in other browsers.

Mike

--
(Unsigned mail from my phone)

Mike Dewhirst

unread,
Oct 2, 2021, 12:25:23 AM10/2/21
to django...@googlegroups.com
David 

I realise I didn't answer your question.

I will review everything but the coincidence would be startling. 


If you remove /img/icon-yes.svg from the above url it would be exactly correct for redisplaying the page.

I'll dig into admin.py

Mike
--
(Unsigned mail from my phone)



-------- Original message --------
From: David Nugent <dav...@uniquode.io>
Date: 2/10/21 12:31 (GMT+10:00)
Subject: Re: Strange ValueError in Safari on iOS

Reply all
Reply to author
Forward
0 new messages