예제 #1
0
def parse_csv(csv_filename):
    with open(csv_filename) as csv_file:
        reader = csv.reader(csv_file)
        next(reader)  # first line has the headers.
        for row in reader:
            yield Business(
                id=int(row[0]),
                uuid=row[1],
                name=row[2],
                address=row[3],
                address2=row[4],
                city=row[5],
                state=row[6],
                zip=row[7],
                country=row[8],
                phone=row[9],
                website=row[10],
                created_at=row[11],
            )
예제 #2
0
def BusinessListView(request):
    model = Business()
    businesses = Business.objects.filter(user=request.user)
    return render(request, 'businesses/business_list.html', {'businesses': businesses})