Thanks for this information
On Wednesday, January 2, 2019 at 1:24:00 PM UTC+1, Osezele Orukpe wrote:
>
> Django class based generic views like DetailView, DeleteView and
> UpdateView should be flexible enough to work with any unique field not just
> slug and primary key field,
> In real project
>
> In real projects primary key and slugs are not used fetch data, a more
> abstract unique key is preferred.
In my experience it's normally primary key that is used. In a recent
project, I've used hashid fields as primary keys to avoid the problem of
leaking database PK's, which is the main mo
Hi,
You can already use any unique field as the slug field, for example:
path('product//', views.ProductDetail.as_view()),
ProductDetail(DetailView)
model = Product
slug_field = 'order_id'
If you want to use a different name in the URL pattern, then
set slug_url_kwarg [
Django class based generic views like DetailView, DeleteView and UpdateView
should be flexible enough to work with any unique field not just slug and
primary key field,
In real projects primary key and slugs are not used fetch data, a more
abstract unique key is preferred.
Yes, this can be easi