title: Django, Redirect user to different page by user's type
body: <p>I want to redirect user to different page by user's type when they login.</p>
  
  <p>I'm using django-allauth for login system and I created a profile table for user that has a OnetoOne field with the user table, like this....</p>
  
  <pre><code>#models.py
  class Profile(models.Model):
  TYPE_CHOICES = (
      ('sup', 'supplier'),
      ('dis', 'distributor'),
  )
  type = models.CharField(max_length=3, choices=TYPE_CHOICES, unique=True, null=True, blank=True, default=None)
  user = models.OneToOneField(User, on_delete=models.CASCADE)
  nationality = CountryField()
  company = models.CharField(max_length=50, unique=True, null=True, blank=True, default=None)
  phone = models.CharField(max_length=50, unique=True, null=True, blank=True, default=None)
  skype = models.CharField(max_length=50, unique=True, null=True, blank=True, default=None)
  address = models.CharField(max_length=50, unique=True, null=True, blank=True, default=None)
  </code></pre>
  
  <p>After their login, they will access a view called "redirect". (exampale.com/app/rediect)</p>
  
  <p>for this view, I'm using this</p>
  
  <pre><code>#views.py
  @login_required
  def redirect(request):
  if request.user.profile.filter(type='sup'):
      return redirect('/app/a')
  elif request.user.profile.filter(type='dis'):
      return redirect('app/b')
  </code></pre>
  
  <p>However, when I access this page. There is a error</p>
  
  <pre><code>File "/opt/project/app/views.py", line 27, in redirect
  if request.user.profile.filter(type='adv'):
  AttributeError: 'Profile' object has no attribute 'filter'
  </code></pre>
  
  <p>Does anyone know what is the problem?</p>