Created Lineup model, view, and template
This commit is contained in:
0
lineups/__init__.py
Normal file
0
lineups/__init__.py
Normal file
3
lineups/admin.py
Normal file
3
lineups/admin.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
6
lineups/apps.py
Normal file
6
lineups/apps.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class LineupsConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'lineups'
|
||||
0
lineups/migrations/__init__.py
Normal file
0
lineups/migrations/__init__.py
Normal file
3
lineups/models.py
Normal file
3
lineups/models.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
28
lineups/templates/lineups/lineup.html
Normal file
28
lineups/templates/lineups/lineup.html
Normal 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
3
lineups/tests.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
9
lineups/urls.py
Normal file
9
lineups/urls.py
Normal 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
11
lineups/views.py
Normal 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':[]})
|
||||
Reference in New Issue
Block a user