Friday, October 1, 2021

Re: Strange ValueError in Safari on iOS

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)



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


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


On Sat, Oct 2, 2021 at 10:47 AM Mike Dewhirst <miked@dewhirst.com.au> wrote:
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.


--
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+unsubscribe@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.

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAE5VhgV1kzWWsGB9%3DEiEKxEAq16wEQQku8NbkJyKtcFrBek-Cg%40mail.gmail.com.

No comments:

Post a Comment