from rest_framework import generics
from .models import {% for name in names %}{% if loop.last %}{{ name }}{% else %}{{ name }},{% endif %}{% endfor %}

from .serializers import {% for name in names %}{% if loop.last %}{{ name }}Serializer{% else %}{{ name }}Serializer,{% endif %}{% endfor %}


{% for name in names %}
class {{ name }}List(generics.ListCreateAPIView):
    queryset = {{ name }}.objects.all()
    serializer_class = {{ name }}Serializer

class {{ name }}Detail(generics.RetrieveUpdateDestroyAPIView):
    queryset = {{ name }}.objects.all()
    serializer_class = {{ name }}Serializer
{% endfor %}
