Answer the question
In order to leave comments, you need to log in
How to use UUID in url without dash?
I use UUIDField as a primary key in some models, inheriting from such a model:
class UuidBasedModel(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
class Meta:
abstract = True
urlpatterns = [
...
path('<pk>/', views.TrainingView.as_view(), name='training_page'),
....
]
Answer the question
In order to leave comments, you need to log in
resolved the issue through
force_str(urlsafe_base64_encode(force_bytes(uuid)))
force_str(urlsafe_base64_decode(encoded_uid))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question