# Path: pinder/users/models.py
# class Isp(models.Model):
# 
#     asn = models.PositiveIntegerField(primary_key=True)
#     name = models.CharField(max_length=128)
# 
#     def __str__(self):
#         return self.name
# 
# class User(AbstractBaseUser, PermissionsMixin):
# 
#     USERNAME_FIELD = "email"
#     REQUIRED_FIELDS = ["name"]
# 
#     name = models.CharField(max_length=128)
#     email = models.EmailField(unique=True)
#     isp = models.ForeignKey(Isp)
# 
#     is_staff = models.BooleanField(
#         "Staff status",
#         default=False,
#         help_text="Designates whether the user can log into the admin site."
#     )
#     is_active = models.BooleanField(
#         "Active",
#         default=True,
#         help_text="Designates whether this user should be treated as active."
#     )
#     date_joined = models.DateTimeField(auto_now_add=True)
#     date_modified = models.DateTimeField(auto_now=True)
# 
#     objects = UserManager()
# 
#     def __str__(self):
#         return self.name
# 
#     def get_absolute_url(self):
#         return "/users/%s/" % self.asn
# 
#     def get_short_name(self):
#         """
#         Django wants this.  Not sure why.
#         """
#         return self.asn
# 
#     def get_username(self):
#         """
#         Required by Django to use as a key for authentication.
#         """
#         return self.email
# 
# Path: pinder/users/serializers.py
# class IspSerializer(serializers.ModelSerializer):
# 
#     class Meta(object):
#         model = Isp
#         fields = ("name", "asn")
# 
# class UserSerializer(serializers.ModelSerializer):
# 
#     isp = IspSerializer(read_only=True)
# 
#     class Meta:
#         model = User
#         fields = ("name", "email", "isp")


from django.contrib.auth import login
from django.core.urlresolvers import reverse
from django.views.generic import RedirectView
from rest_framework.permissions import AllowAny
from rest_framework.viewsets import ModelViewSet
from .models import Isp, User
from .serializers import IspSerializer, UserSerializer




class IspViewSet(ModelViewSet):
    model = Isp
    queryset = Isp.objects.all()

# Path: pinder/users/models.py
# class Isp(models.Model):
# 
#     asn = models.PositiveIntegerField(primary_key=True)
#     name = models.CharField(max_length=128)
# 
#     def __str__(self):
#         return self.name
# 
# class User(AbstractBaseUser, PermissionsMixin):
# 
#     USERNAME_FIELD = "email"
#     REQUIRED_FIELDS = ["name"]
# 
#     name = models.CharField(max_length=128)
#     email = models.EmailField(unique=True)
#     isp = models.ForeignKey(Isp)
# 
#     is_staff = models.BooleanField(
#         "Staff status",
#         default=False,
#         help_text="Designates whether the user can log into the admin site."
#     )
#     is_active = models.BooleanField(
#         "Active",
#         default=True,
#         help_text="Designates whether this user should be treated as active."
#     )
#     date_joined = models.DateTimeField(auto_now_add=True)
#     date_modified = models.DateTimeField(auto_now=True)
# 
#     objects = UserManager()
# 
#     def __str__(self):
#         return self.name
# 
#     def get_absolute_url(self):
#         return "/users/%s/" % self.asn
# 
#     def get_short_name(self):
#         """
#         Django wants this.  Not sure why.
#         """
#         return self.asn
# 
#     def get_username(self):
#         """
#         Required by Django to use as a key for authentication.
#         """
#         return self.email
# 
# Path: pinder/users/serializers.py
# class IspSerializer(serializers.ModelSerializer):
# 
#     class Meta(object):
#         model = Isp
#         fields = ("name", "asn")
# 
# class UserSerializer(serializers.ModelSerializer):
# 
#     isp = IspSerializer(read_only=True)
# 
#     class Meta:
#         model = User
#         fields = ("name", "email", "isp")


# Path: pinder/users/views.py
from django.contrib.auth import login
from django.core.urlresolvers import reverse
from django.views.generic import RedirectView
from rest_framework.permissions import AllowAny
from rest_framework.viewsets import ModelViewSet
from .models import Isp, User
from .serializers import IspSerializer, UserSerializer





class IspViewSet(ModelViewSet):
    model = Isp
    queryset = Isp.objects.all()

    serializer_class = IspSerializer