# Path: warp/users/models.py
# class User(AbstractUser):
# 
#     # First Name and Last Name do not cover name patterns
#     # around the globe.
#     name = models.CharField(_('Name of User'), blank=True, max_length=255)
# 
#     def __str__(self):
#         return self.username
# 
#     def get_profile_image_url(self):
#         social_image = None
#         if self.socialaccount_set.all():
#             social_image = self.socialaccount_set.all()[0].get_avatar_url()
#         if social_image:
#             return social_image
#         return '/static/images/default_profile.svg'
# 
#     def get_absolute_url(self):
#         return reverse('users:detail', kwargs={'username': self.username})


from django.contrib.postgres.search import SearchVector, SearchQuery
from django.core.urlresolvers import reverse
from django.db import models
from django.db.models import Manager
from django.db.models import QuerySet
from model_utils.models import TimeStampedModel
from taggit.managers import TaggableManager
from warp.users.models import User
        return self.get_queryset().search(query)


class Presentation(TimeStampedModel):
    subject = models.CharField(max_length=50)
    author = models.ForeignKey(User, on_delete=models.CASCADE, related_name='author')
    views = models.IntegerField(default=0)
    likes = models.IntegerField(default=0)
    is_public = models.BooleanField(default=True)
    tags = TaggableManager()

    like_users = models.ManyToManyField(User, related_name='like_users')

    def like_toggle(self, user):
        is_like = self.is_user_like_presentation(user)
        if is_like:
            self.like_users.remove(user)
        else:
            self.like_users.add(user)

        result_like = not is_like
        self.likes = self.like_users.count()
        self.save()
        return result_like

    def is_user_like_presentation(self, user):
        is_like = False
        try:
            self.like_users.get(id=user.id)
            is_like = True

# Path: warp/users/models.py
# class User(AbstractUser):
# 
#     # First Name and Last Name do not cover name patterns
#     # around the globe.
#     name = models.CharField(_('Name of User'), blank=True, max_length=255)
# 
#     def __str__(self):
#         return self.username
# 
#     def get_profile_image_url(self):
#         social_image = None
#         if self.socialaccount_set.all():
#             social_image = self.socialaccount_set.all()[0].get_avatar_url()
#         if social_image:
#             return social_image
#         return '/static/images/default_profile.svg'
# 
#     def get_absolute_url(self):
#         return reverse('users:detail', kwargs={'username': self.username})


# Path: presentation/models.py
from django.contrib.postgres.search import SearchVector, SearchQuery
from django.core.urlresolvers import reverse
from django.db import models
from django.db.models import Manager
from django.db.models import QuerySet
from model_utils.models import TimeStampedModel
from taggit.managers import TaggableManager
from warp.users.models import User

        return self.get_queryset().search(query)


class Presentation(TimeStampedModel):
    subject = models.CharField(max_length=50)
    author = models.ForeignKey(User, on_delete=models.CASCADE, related_name='author')
    views = models.IntegerField(default=0)
    likes = models.IntegerField(default=0)
    is_public = models.BooleanField(default=True)
    tags = TaggableManager()

    like_users = models.ManyToManyField(User, related_name='like_users')

    def like_toggle(self, user):
        is_like = self.is_user_like_presentation(user)
        if is_like:
            self.like_users.remove(user)
        else:
            self.like_users.add(user)

        result_like = not is_like
        self.likes = self.like_users.count()
        self.save()
        return result_like

    def is_user_like_presentation(self, user):
        is_like = False
        try:
            self.like_users.get(id=user.id)
            is_like = True

        except User.DoesNotExist: