from django.shortcuts import render
from django.views import View
from businesses.models import Business


class LandingPageView(View):
    """The marketing landing page at /."""

    def get(self, request):
        trusted_businesses = Business.objects.filter(
            sales__isnull=False
        ).distinct().order_by('created_at')

        return render(request, 'landing/index.html', {
            'trusted_businesses': trusted_businesses,
        })


class LegalPageView(View):
    """Combined Terms of Service & Privacy Policy page."""

    def get(self, request):
        return render(request, 'landing/legal.html')

