Created Lineup model, view, and template

This commit is contained in:
2021-11-10 15:34:26 -06:00
parent b5509bf26f
commit 6e3901ab05
9 changed files with 63 additions and 0 deletions

0
lineups/__init__.py Normal file
View File

3
lineups/admin.py Normal file
View File

@@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

6
lineups/apps.py Normal file
View File

@@ -0,0 +1,6 @@
from django.apps import AppConfig
class LineupsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'lineups'

View File

3
lineups/models.py Normal file
View File

@@ -0,0 +1,3 @@
from django.db import models
# Create your models here.

View File

@@ -0,0 +1,28 @@
{% extends 'base.html' %}{% block title %} {{ title }} {% endblock %}
{% block content %}
<h1>{{ title }}</h1>
{{ event.away_team.name }} vs. {{ event.home_team.name }} <br>
{{ event.start|date:"l, F j, Y g:i A" }} <br>
{{ event.venue.name }} <br>
<div class="container">
<div class="row">
<div class="col-6">
<ul class="list-group">
{% for li in lineup %}
<li class="list-group-item">{{ l_i }}</li>
{% endfor %}
</ul>
</div>
<div class="col-6">
<ul class="list-group">
{% for player in players %}
<li class="list-group-item">{{ player.first_name }} {{ player.last_name }}</li>
{% endfor %}
</ul>
</div>
</div>
</div>
{% endblock %}

3
lineups/tests.py Normal file
View File

@@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

9
lineups/urls.py Normal file
View File

@@ -0,0 +1,9 @@
from django.contrib import admin
from django.urls import path, include
from . import views
urlpatterns = [
path('edit/<int:id>', views.edit, name="edit lineup"),
]

11
lineups/views.py Normal file
View File

@@ -0,0 +1,11 @@
from django.shortcuts import render
from django.http import HttpResponse
from events.models import Event
from players.models import Player
# Create your views here.
def edit(request, id):
event = Event.objects.get(id=id)
players = Player.objects.all()
print(event)
return render(request, 'lineups/lineup.html', {'title': 'Lineup', 'event': event, 'players': players, 'lineup':[]})