class Product(models.Model):
    title = models.CharField(max_length=225, unique=True)
    slug = models.SlugField(max_length=225, unique=True, null=True)

class ProductAdmin(admin.ModelAdmin):
    prepopulated_fields = {'slug': ('title',)}

class productDetail(generic.DetailView):
    model = Detail
    template_name = 'detail.html'

    path('product/<slug:slug>/', views.productDetail.as_view(), name='productDetail'),
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter