def machine(request, username, machine_id): user = get_object_or_404(get_user_model(), username=username) machine = get_object_or_404(Machine, pk=machine_id, user=user) races = RacesByYear() races.get_races(Q(machine_config__machine=machine)) return render(request, 'laps/machine.html', { 'racer' : user.username, 'machine': machine, 'races':races.races, 'years':races.years, 'dates':races.dates})
def races(request, username): user = get_user_model().objects.get(username=username) races = RacesByYear() races.get_races(Q(user=user)) return render( request, 'laps/races.html', { 'racer': user.username, 'races': races.races, 'years': races.years, 'dates': races.dates })
def machine(request, username, machine_id): user = get_object_or_404(get_user_model(), username=username) machine = get_object_or_404(Machine, pk=machine_id, user=user) races = RacesByYear() races.get_races(Q(machine_config__machine=machine)) return render( request, 'laps/machine.html', { 'racer': user.username, 'machine': machine, 'races': races.races, 'years': races.years, 'dates': races.dates })