I have model which have URLField set to unique
item_url = models.URLField(max_length=255, unique=True)
Problem is when I get data from frontend(VueJS) I might get URL with extra slash.
e.g. I have below URL in my db:
https://themeforest.net/item/vuesax-vuejs-admin-dashboard-template/23328599
and User sent request with same url but with trailing slash like below:
https://themeforest.net/item/vuesax-vuejs-admin-dashboard-template/23328599/
In this case, unique validation thinks it is two different URL but actually both of them are same.
Plus, it will be better to store URLs without trailing slashes.
So, What is the best way to handle it? Does Django provides something to handle this kind of scenario?
I am using Django + DRF.
Thanks