from import_export import resources

from .models import Member, Payment, Request


class MemberResource(resources.ModelResource):
    class Meta:
        model = Member
        exclude = ["id", "created"]


class PaymentResource(resources.ModelResource):
    member = resources.Field()

    class Meta:
        model = Payment
        exclude = ["id"]

    def dehydrate_member(self, payment):
        return "{} {}".format(payment.member.first_name, payment.member.last_name)


class ApplicationResource(resources.ModelResource):
    class Meta:
        model = Request
        exclude = ["id"]
