help on passing UUID field as pk to django url

71 views
Skip to first unread message

ola neat

unread,
Jul 10, 2021, 4:49:40 AM7/10/21
to django...@googlegroups.com
good day guys, i've got an iss passing a uuid field as a route params to my url
below is my codesnipet  and err msg
image.png
image.png

image.png



Sharif Mehedi

unread,
Jul 10, 2021, 7:43:53 AM7/10/21
to django...@googlegroups.com

Do not use uuid as pk. keep a separate field for uuid preferably a CharField.

Regards,
Sharif
--
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/CAHLKn71URr_bb0Q8qYB%2BijiWpNe72qXXf3N%2Bzv6uF-1czYV8DQ%40mail.gmail.com.

Sharif Mehedi

unread,
Jul 10, 2021, 7:45:19 AM7/10/21
to django...@googlegroups.com
No! not CharField, UUID field is good! (Y) but do not use it as pk.

Regards,
Sharif

Sebastian Jung

unread,
Jul 11, 2021, 6:36:38 AM7/11/21
to django...@googlegroups.com
Hello,

i used it same as you. I don't find any problem in your code. My code is absolute same. But i use instead of SQLite Postgresql but i think this also works with SQLite. Please delete database and migrations and migrate a new database. This should work...

Regards

Reply all
Reply to author
Forward
0 new messages