示例#1
0
def enter_schedule(request):
    if request.method == 'GET':

        return render(request, 'sportsmerchandise/enter_schedule.html', {'form': EventForm })

    elif request.method == 'POST':
        form = EventForm(request.POST)
        if form.is_valid():
            form.save()
            return redirect('enter_opponent')
        else:
            return render(request, 'sportsmerchandise/enter_schedule.html', {'form': form})
示例#2
0
def secondary_analytics(request):
    if request.method == 'GET':
        form = EventForm(request.GET)
        if form.is_valid():
            modifier = int(request.GET.get('modifier'))
            if modifier == 1:
                result = Sale.objects.total_sales_by_opponent(form.cleaned_data['opponent'].home_town,
                                                              form.cleaned_data['opponent'].name,
                                                              form.cleaned_data['home_or_away'])
                header = "Total sales by opponent"
            elif modifier == 2:
                result = Sale.objects.total_sales_by_item_by_opponent(form.cleaned_data['opponent'].home_town,
                                                                      form.cleaned_data['opponent'].name,
                                                                      form.cleaned_data['home_or_away'])
                header = "Total sales by item by opponent"
            return render(request, 'sportsmerchandise/table.html', {'result': result, 'header': header})
        else:
            return render(request, 'sportsmerchandise/analytics.html', {'form':DateForm, 'form2': form})