# Path: moto/moe/models.py
# IMAGE_SIZE = getattr(settings,  'IMAGE_SIZE', None)
# def uuid():
#     def __unicode__(self):
#     def get_image_url(self ):
#     def posted_datetime(self):
#     def admin_thumbnail(self):
#     def admin_thumbnail(self):
# class Post(models.Model):
#     class Meta:
# class Like(models.Model):
#     class Meta:
# class Board(models.Model):
# class User(AbstractUser):


from rest_framework import serializers
from moto.moe import  models
from django.contrib.auth import get_user_model
from django.core.urlresolvers import reverse
from django.conf import settings
from six.moves.urllib.parse import urlparse
from django_comments_threaded.api.serializers import CommentSerializer as BaseCommentSerializer
from django_comments_threaded.utils import get_model
from rest_auth.serializers import TokenSerializer as BaseTokenSerializer
from django.utils import formats
from django.utils import timezone
from django.contrib.contenttypes.models import ContentType
import os

IMAGE_SIZE = getattr(settings,  'IMAGE_SIZE', None)

class UserBaseSerializer(serializers.ModelSerializer):
    name = serializers.SerializerMethodField()
    avatar = serializers.SerializerMethodField()
    _is_authenticated  = serializers.SerializerMethodField()
    class Meta:
        model = get_user_model()
        extra_kwargs = {'password': {'write_only': True}}

    def create(self, validated_data):
        user = get_user_model()(
            email=validated_data['email'],
            username=validated_data['username']
        )
        user.set_password(validated_data['password'])
        user.save()
        return user

# Path: moto/moe/models.py
# IMAGE_SIZE = getattr(settings,  'IMAGE_SIZE', None)
# def uuid():
#     def __unicode__(self):
#     def get_image_url(self ):
#     def posted_datetime(self):
#     def admin_thumbnail(self):
#     def admin_thumbnail(self):
# class Post(models.Model):
#     class Meta:
# class Like(models.Model):
#     class Meta:
# class Board(models.Model):
# class User(AbstractUser):


# Path: moto/moe/api/serializers.py
from rest_framework import serializers
from moto.moe import  models
from django.contrib.auth import get_user_model
from django.core.urlresolvers import reverse
from django.conf import settings
from six.moves.urllib.parse import urlparse
from django_comments_threaded.api.serializers import CommentSerializer as BaseCommentSerializer
from django_comments_threaded.utils import get_model
from rest_auth.serializers import TokenSerializer as BaseTokenSerializer
from django.utils import formats
from django.utils import timezone
from django.contrib.contenttypes.models import ContentType
import os


IMAGE_SIZE = getattr(settings,  'IMAGE_SIZE', None)

class UserBaseSerializer(serializers.ModelSerializer):
    name = serializers.SerializerMethodField()
    avatar = serializers.SerializerMethodField()
    _is_authenticated  = serializers.SerializerMethodField()
    class Meta:
        model = get_user_model()
        extra_kwargs = {'password': {'write_only': True}}

    def create(self, validated_data):
        user = get_user_model()(
            email=validated_data['email'],
            username=validated_data['username']
        )
        user.set_password(validated_data['password'])
        user.save()
        return user

    def get_avatar(self, obj):