from rest_framework import serializers
from drf_dynamic_fields import DynamicFieldsMixin

{%- set margin = app_name|length + models_file|length + 15 %}
{% set leading_space = " " * margin -%}

# import models
from {{app_name}}.{{models_file}} import ({% for model in model_list %}{% if not loop.first %}{{leading_space}}{% endif %}{{ model.__name__ }}{{ "," if not loop.last }}{{"\n"}}{% endfor %}{{leading_space}})
{% for model, field_list in model_fields.items() %}

class {{ model.__name__ }}Serializer(serializers.ModelSerializer):
    class Meta:
        model = {{ model.__name__ }}
        fields = [{% for field in field_list %}'{{ field }}', {% endfor %}]
        depth = 0
{% endfor -%}
