title: Is there a way to get the time of users last logout time Django example user.last_logout (does anything like this exist)
body: <p><strong>Intro:</strong> I have a 3 models <code>user</code>, <code>post</code>, <code>group</code>. User is able to make posts however each post has to belong to a group. Users have to choose from the existing groups for their posts. Users cannot add, delete, update group's.</p>
  
  <p>Furthermore:</p>
  
  <p>Users can become a member of groups and when they click on a certain group. They see all the posts in that group. </p>
  
  <p><strong>What I want</strong> When Users come on the home page they see posts that were added since the last time they logged in </p>
  
  <p><a href="https://i.stack.imgur.com/gV0pT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gV0pT.png" alt="enter image description here"></a></p>
  
  <p><strong>My Models</strong></p>
  
  <pre><code>class Post(models.Model):
      user = models.ForeignKey(User, related_name='posts')
      group = models.ForeignKey(Group, related_name='posts')
      title = models.CharField(max_length=250, unique=True)
      message = models.TextField()
      created_at = models.DateTimeField(auto_now=True)
  </code></pre>
  
  <p><strong>My Views</strong></p>
  
  <pre><code>class Homepage(TemplateView):
      template_name = 'home.html'
  
      def get_context_data(self, **kwargs):
          context = super(Homepage, self).get_context_data(**kwargs)  
          if self.request.user.is_authenticated():
              context['object_list'] = Group.objects.filter(members=self.request.user)
  
              #The last login actually shows the users current login time as the last login. Which makes the below line of code useless
              new_posts = Post.objects.filter(created_at__gt=self.request.user.last_login).count()
              context['new_posts'] = new_posts
           else:
                context['object_list'] = Group.objects.all()
          return context
  </code></pre>
  
  <p>In my templates I have</p>
  
  <pre><code>&lt;div class="list-group"&gt;
     {% for group in object_list %}        
         {% if not new_posts %}
                 {{group.post.count}}
          {% else %}
                  {{new_posts}}
          {% endif %}
      {% endfor %}
  &lt;/div&gt;
  </code></pre>
  
  <blockquote>
    <p><strong>The Issue:</strong> The last login actually shows the users current login time as the last login. Is there a way to get users last logout time instead of last login time example user.last_logout  </p>
  </blockquote>
  
  <p>I have the below answer but it doesn't seem to work for me
  <a href="https://stackoverflow.com/questions/53805056/django-created-at-gt-self-request-user-last-login-workinly-only-on-users-alread/53805298#53805298">Django created_at__gt=self.request.user.last_login workinly only on users already signed in.</a></p>
  
  <blockquote>
    <p>My profile create function</p>
  </blockquote>
  
  <pre><code>def signup(request):
      if request.method == 'POST':
          form = UserCreateForm(request.POST or None)
          if form.is_valid():
              new_user = form.save()
              Profile.objects.create(user=new_user)
              return redirect('accounts:edit_profile')
  </code></pre>