# Path: examples/django_rest_framework/backend/backend/api/mixins.py
# class ModelViewSet(FilterByKeyMixin, viewsets.ModelViewSet):
#     pass
# 
# Path: examples/django_rest_framework/backend/backend/api/models.py
# class Account(models.Model):
#     email = models.CharField(max_length=30)
# 
# class Reporter(models.Model):
#     account = models.OneToOneField(Account, related_name='reporter')
#     first_name = models.CharField(max_length=30)
#     last_name = models.CharField(max_length=30)
# 
# class Article(models.Model):
#     headline = models.CharField(max_length=100)
#     pub_date = models.DateField()
#     reporter = models.ForeignKey(Reporter, related_name='articles')
# 
# class Tag(models.Model):
#     label = models.CharField(max_length=30)
#     articles = models.ManyToManyField(Article, related_name='tags')


from .mixins import ModelViewSet
from .models import Account, Reporter, Article, Tag
from .serializers import AccountSerializer, ReporterSerializer, ArticleSerializer, \
    TagSerializer, ReversedReporterSerializer, ReversedArticleSerializer, \
    ReversedTagSerializer, ReversedAccountSerializer
    queryset = Article.objects.all()
    serializer_class = ArticleSerializer


class TagViewSet(ModelViewSet):
    queryset = Tag.objects.all()
    serializer_class = TagSerializer
    # Do not paginate the tags, for unpaginated testing
    paginate_by = None


# Reversed


class ReversedTagViewSet(ModelViewSet):
    queryset = Tag.objects.all()
    serializer_class = ReversedTagSerializer


class ReversedArticleViewSet(ModelViewSet):
    queryset = Article.objects.all()
    serializer_class = ReversedArticleSerializer


class ReversedReporterViewSet(ModelViewSet):
    queryset = Reporter.objects.all()
    serializer_class = ReversedReporterSerializer


class ReversedAccountViewSet(ModelViewSet):

# Path: examples/django_rest_framework/backend/backend/api/mixins.py
# class ModelViewSet(FilterByKeyMixin, viewsets.ModelViewSet):
#     pass
# 
# Path: examples/django_rest_framework/backend/backend/api/models.py
# class Account(models.Model):
#     email = models.CharField(max_length=30)
# 
# class Reporter(models.Model):
#     account = models.OneToOneField(Account, related_name='reporter')
#     first_name = models.CharField(max_length=30)
#     last_name = models.CharField(max_length=30)
# 
# class Article(models.Model):
#     headline = models.CharField(max_length=100)
#     pub_date = models.DateField()
#     reporter = models.ForeignKey(Reporter, related_name='articles')
# 
# class Tag(models.Model):
#     label = models.CharField(max_length=30)
#     articles = models.ManyToManyField(Article, related_name='tags')


# Path: examples/django_rest_framework/backend/backend/api/views.py
from .mixins import ModelViewSet
from .models import Account, Reporter, Article, Tag
from .serializers import AccountSerializer, ReporterSerializer, ArticleSerializer, \
    TagSerializer, ReversedReporterSerializer, ReversedArticleSerializer, \
    ReversedTagSerializer, ReversedAccountSerializer

    queryset = Article.objects.all()
    serializer_class = ArticleSerializer


class TagViewSet(ModelViewSet):
    queryset = Tag.objects.all()
    serializer_class = TagSerializer
    # Do not paginate the tags, for unpaginated testing
    paginate_by = None


# Reversed


class ReversedTagViewSet(ModelViewSet):
    queryset = Tag.objects.all()
    serializer_class = ReversedTagSerializer


class ReversedArticleViewSet(ModelViewSet):
    queryset = Article.objects.all()
    serializer_class = ReversedArticleSerializer


class ReversedReporterViewSet(ModelViewSet):
    queryset = Reporter.objects.all()
    serializer_class = ReversedReporterSerializer


class ReversedAccountViewSet(ModelViewSet):

    queryset = Account.objects.all()