Slug in Django umleiten

from django.shortcuts import get_object_or_404, redirect

def post(request, slug, post_id):
    obj = get_object_or_404(Post, pk=post_id)
    if obj.slug != slug:
        return redirect('post', slug=obj.slug, post_id=obj.pk)
Arfaouim