title: show different content based on logged in user django
body: <p>So I just learned Python/Django last weekend. What I'm trying to do is have url routes available with different content depending on who's logged in. So my usecase is I create 5 usernames/passwords and then those 5 users can login to read specific content/routes catered to them that no other user should be able to see.</p>
  
  <p>Right now I have these routes with correlating views. </p>
  
  <pre><code>urlpatterns = [
      url(r'^$', accounts.views.loginview),
      url(r'^accounts/', include('accounts.urls')),
      url(r'^sitepages/', include('sitepages.urls')),
  ]
  </code></pre>
  
  <p>I get the auth thing, I'm filtering content to only logged in users using @login_required, it looks like this :</p>
  
  <pre><code>from django.shortcuts import render
  from django.contrib.auth.decorators import login_required
  
  @login_required
  def attributes(request):
      return render(request, 'sitepages/something.html')
  </code></pre>
  
  <p>I've researched how to have a different menu bar depending on the user, etc. But I haven't been able to find how to have entirely different routes and content pages depending on the user. </p>
  
  <p>I think I'll need to do this using groups in Django and I think that I'll need to use the user's foreign key in order to cater the content. I created one group using admin, but I'm having a hard time consolidating my next step. </p>
  
  <p>These are the resources I've checked out:</p>
  
  <p><a href="https://stackoverflow.com/questions/39354715/django-database-routing-based-on-current-user-logged-in">Django Database routing based on current user logged in</a></p>
  
  <p><a href="https://stackoverflow.com/questions/36032321/django-restrict-pages-to-certain-users">Django restrict pages to certain users</a></p>
  
  <p><a href="https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Authentication" rel="nofollow noreferrer">https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Authentication</a></p>
  
  <p><a href="https://docs.djangoproject.com/en/1.10/topics/auth/default/" rel="nofollow noreferrer">https://docs.djangoproject.com/en/1.10/topics/auth/default/</a></p>
  
  <p>I'm on Python version 3.6.0; Django version 1.10.6</p>