title: Adding a success message to a generic redirect view in Django
body: <p>I currently have a project where people can create posts. I want to display a message saying that a post has been Upvoted successfully however the SuccessMessageMixin isn't working. Ive tried other methods which is included in my code which I will post below. The SuccessMessageMixin works for other views. Im not sure why it isn't working for this View.</p>
  <p>Redirect View where code DOES NOT  work</p>
  <pre><code>class PostUpvoteRedirect(SuccessMessageMixin, RedirectView):
      model = Post
      success_message = &quot;Post was upvoted successfully&quot;
      def get_redirect_url(self, *args, **kwargs):
          obj = get_object_or_404(
              Post,
              publish__year=self.kwargs['year'],
              publish__month=self.kwargs['month'],
              publish__day=self.kwargs['day'],
              slug=self.kwargs['post'],
          )
          url_ = obj.get_absolute_url()
          user = self.request.user
          if (user != None):
              if user in obj.Upvote.all():
                  obj.Upvote.remove(user)
              else:
                  obj.Upvote.add(user)
                  if user in obj.Downvote.all():
                      obj.Downvote.remove(user)
              success_message = &quot;Post was upvoted successfully&quot;
          return url_
  </code></pre>
  <p>Code where it DOES work</p>
  <pre><code>class PostCreateView(SuccessMessageMixin, LoginRequiredMixin, CreateView):
      model = Post
      fields = ['title','body']
      success_message = &quot;Post was created successfully&quot;
  
      def form_valid(self, form):
          form.instance.author = self.request.user
          return super().form_valid(form)
  </code></pre>