1👍
✅
The UUID is not NULL
, so user_id=None
will not work, it is the string None
, so you retrieve this with:
User.objects.get(user_id='None')
A UUID is on most databases just a CharField
that stores the UUID as a string, so it will call str(…)
on it, and apparently it did that on the None
object.
0👍
from uuid import UUID
try:
user_uuid = UUID("your_uuid_here") # Replace "your_uuid_here" with the actual UUID
user = User.objects.get(user_id=user_uuid)
except User.DoesNotExist:
# Handle the case where the user doesn't exist
user = None # Or any other appropriate action
- [Answered ]-Django and a referrer system implementation
- [Answered ]-Post Binary Sting to Django app using HTML 5
- [Answered ]-Django – Receiving JSON from Google Maps API
- [Answered ]-Django 1.5 UnicodeEncodeError using attach_alternative in emails
- [Answered ]-Django Form Errors Won't Display
Source:stackexchange.com