title: Django redirect, reverse
body: <p>How can i do it so the user after editing the post doesn't get redirected to homepage but to the detail view of the post they just edited</p>
  <p><strong>My views.py</strong></p>
  <pre><code>from . models import Post
  from django.contrib.auth.decorators import login_required
  from django.contrib.auth.mixins import LoginRequiredMixin
  from django.views.generic import DeleteView, UpdateView, CreateView
  from django.urls import reverse_lazy
  
  def home(request):
      posts = Post.objects.all()
      return render(request, 'pages/index.html', {'posts':posts})
      
  def detail(request, slug):
      post = Post.objects.get(slug=slug)
      return render(request, 'pages/detail.html', {'post':post})
      
  class edit(LoginRequiredMixin, UpdateView):
      model = Post
      template_name = 'pages/edit.html'
      fields = ['title','image','body']
      success_url = reverse_lazy('pages:homepage')
      
      def dispatch(self, request, *args, **kwargs):
          handler = super().dispatch(request, *args, **kwargs)
          user = request.user
          post = self.get_object()
          if post.author != user:
              raise PermissionDenied
          return handler
  </code></pre>
  <p><strong>my models.py</strong></p>
  <pre><code>from django.db import models
  from django.contrib.auth.models import User
  from django.urls import reverse
  from django.db.models.signals import pre_save
  from A_Tech_Blog.utils import unique_slug_generator
  
  class Post(models.Model):
      title = models.CharField(max_length=300)
      slug = models.SlugField(blank=True, null=True, max_length=300)
      image = models.ImageField(upload_to='post_images', default='default.jpg')
      time_created = models.DateTimeField(auto_now_add=True)
      views = models.IntegerField(default=0)
      body = models.TextField()
      author = models.ForeignKey(User, on_delete=models.CASCADE)
      
      def __str__(self):
          return f'{self.title} -- Author={str(self.author)}'
          
      class Meta:
          ordering = ['-time_created']
          verbose_name_plural = 'Posts'
          
      def get_absolute_url(self):
          return reverse('pages:detail', args=(self.slug))
          
          
  def slug_generator(sender, instance, *args, **kwargs):
      if not instance.slug:
          instance.slug = unique_slug_generator(instance)
          
  pre_save.connect(slug_generator, sender=Post)
  </code></pre>
  <p>I want to be able to edit the post then get directed to the detail view of the post instead of being redirected to the web app homepage</p>