from django.core import serializers
from django.shortcuts import render, get_object_or_404
from django.urls import reverse
from django.http import JsonResponse
from . import models


def home(request):
    return render(request, "business01/home.html", {
        'businesses': models.Business.objects.all(),
    })

def business_list(request):
    return render(request, "business01/list.html", {
        'businesses': models.Business.objects.all(),
    })

def business(request, pk):
    business = get_object_or_404(models.Business.objects, id=pk)
    context = {
        'business' : business,
    }
    return render(request, "business01/business_detail.html", context)

def api(request):
    business = request.GET.get('business')

    businesses = models.Business.objects.all()

    data = {
        "businesses": [w.to_json() for w in businesses],
    }

    return JsonResponse(data)

6577749390f10da272263acf8b2fd573fe14ceb5
<mask token>


def home(request):
    return render(request, 'business01/home.html', {'businesses': models.
        Business.objects.all()})


<mask token>


def api(request):
    business = request.GET.get('business')
    businesses = models.Business.objects.all()
    data = {'businesses': [w.to_json() for w in businesses]}
    return JsonResponse(data)

<mask token>


def home(request):
    return render(request, 'business01/home.html', {'businesses': models.
        Business.objects.all()})


def business_list(request):
    return render(request, 'business01/list.html', {'businesses': models.
        Business.objects.all()})


<mask token>


def api(request):
    business = request.GET.get('business')
    businesses = models.Business.objects.all()
    data = {'businesses': [w.to_json() for w in businesses]}
    return JsonResponse(data)

<mask token>


def home(request):
    return render(request, 'business01/home.html', {'businesses': models.
        Business.objects.all()})


def business_list(request):
    return render(request, 'business01/list.html', {'businesses': models.
        Business.objects.all()})


def business(request, pk):
    business = get_object_or_404(models.Business.objects, id=pk)
    context = {'business': business}
    return render(request, 'business01/business_detail.html', context)


def api(request):
    business = request.GET.get('business')
    businesses = models.Business.objects.all()
    data = {'businesses': [w.to_json() for w in businesses]}
    return JsonResponse(data)

from django.core import serializers
from django.shortcuts import render, get_object_or_404
from django.urls import reverse
from django.http import JsonResponse
from . import models


def home(request):
    return render(request, 'business01/home.html', {'businesses': models.
        Business.objects.all()})


def business_list(request):
    return render(request, 'business01/list.html', {'businesses': models.
        Business.objects.all()})


def business(request, pk):
    business = get_object_or_404(models.Business.objects, id=pk)
    context = {'business': business}
    return render(request, 'business01/business_detail.html', context)


def api(request):
    business = request.GET.get('business')
    businesses = models.Business.objects.all()
    data = {'businesses': [w.to_json() for w in businesses]}
    return JsonResponse(data)

from django.core import serializers
from django.shortcuts import render, get_object_or_404
from django.urls import reverse
from django.http import JsonResponse
from . import models


def home(request):
    return render(request, "business01/home.html", {
        'businesses': models.Business.objects.all(),
    })

def business_list(request):
    return render(request, "business01/list.html", {
        'businesses': models.Business.objects.all(),
    })

def business(request, pk):
    business = get_object_or_404(models.Business.objects, id=pk)
    context = {
        'business' : business,
    }
    return render(request, "business01/business_detail.html", context)

def api(request):
    business = request.GET.get('business')

    businesses = models.Business.objects.all()

    data = {
        "businesses": [w.to_json() for w in businesses],
    }

    return JsonResponse(data)
