Add missing url patterns.

This commit is contained in:
Chris GIACOFEI 2024-06-05 10:27:13 -04:00
parent 4c6fe9824d
commit be3eb2fefe
8 changed files with 23 additions and 19 deletions

View File

@ -1,8 +1,6 @@
from django.urls import include, path
from django.contrib import admin
from django.contrib.flatpages import views
from django.urls import path
from .views import home
urlpatterns = [
path('', home, name='home'),
]

10
beer/views.py Normal file
View File

@ -0,0 +1,10 @@
from django.shortcuts import render, get_object_or_404
from django.views.generic import ListView
from django.http import HttpResponse
from .models import Recipe
from config.extras import AveryLabel
def home(request):
return render(request, 'beer/home.html',{'beer':Recipe.objects.all()})

View File

@ -2,10 +2,6 @@ from django.urls import include, path
from django.contrib import admin
from .views import home
from django.contrib.sites.models import Site
admin.site.unregister(Site)
urlpatterns = [
path('admin/doc/', include('django.contrib.admindocs.urls')),
path('admin/', admin.site.urls),

View File

@ -7,7 +7,7 @@
<!-- Main jumbotron for a primary marketing message or call to action -->
<div class="jumbotron">
<div class="container">
<h1 class="display-3">Kegging Dashboard</h1>
<h1 class="display-3">Equipment Dashboard</h1>
</div>
</div>
@ -17,6 +17,7 @@
</div> <!-- /container -->
<div class="container">
<form action="{% url 'equipment:labels' %}" method="post">
{% csrf_token %}
<fieldset>
<legend>Existing Equipment</legend>
<ul>
@ -24,7 +25,7 @@
<li>
<label for="{{ equipment.id }}">
<input type="checkbox" id="{{ equipment.id }}" name="equipment_list" value="{{ equipment.id }}"/>
<a href="{% url 'kegs:equipment' equipment.id %}">{{ equipment.keg_type.name }} ID: {{ equipment.id }}</a> Currently: {{ equipment.state.name }}
<a href="{% url 'equipment:equipment' equipment.id %}">{{ equipment.keg_type.name }} ID: {{ equipment.id }}</a> Currently: {{ equipment.state.name }}
</label>
</li>
{% endfor %}

View File

@ -1,5 +1,4 @@
from django.urls import include, path
from django.contrib import admin
from django.urls import path
from .views import equipment_labels, home, EquipmentListView, equipment

View File

@ -11,17 +11,17 @@
<div class="col-md-4">
<h2>Yeast Lab</h2>
<p>All that fun sciency stuff. </p>
<p><a class="btn btn-secondary" href="/yeast/" role="button">Go &raquo;</a></p>
<p><a class="btn btn-secondary" href="{% url 'yeast:home' %}" role="button">Go &raquo;</a></p>
</div>
<div class="col-md-4">
<h2>Kegs</h2>
<h2>Equipment</h2>
<p>Maintenance stuff. </p>
<p><a class="btn btn-secondary" href="/kegs/" role="button">Go &raquo;</a></p>
<p><a class="btn btn-secondary" href="{% url 'equipment:home' %}" role="button">Go &raquo;</a></p>
</div>
<div class="col-md-4">
<h2>Recipes</h2>
<p>My own personal Brewfather?</p>
<p><a class="btn btn-secondary" href="/beer/" role="button">Go &raquo;</a></p>
<p><a class="btn btn-secondary" href="{% url 'beer:home' %}" role="button">Go &raquo;</a></p>
</div>
</div>

View File

@ -1,7 +1,6 @@
from django.urls import include, path
from django.contrib.auth.decorators import login_required
from django.contrib import admin
from django.contrib.flatpages import views
from yeast.views import YeastListView, BatchListView, home, sample, batch, batch_labels, addBatch, addStrain
@ -16,4 +15,5 @@ urlpatterns = [
path('batches/<int:batch_id>/', batch, name='batch'),
path('batches/', BatchListView.as_view(), name='batches'),
path('batch_labels/<int:batch_id>/', login_required(batch_labels), name='labels'),
path('', home, name='home'),
]

View File

@ -25,7 +25,7 @@ def sample(request, yeast_id):
return render(request, 'yeast/sample.html', {'sample': sample, 'batch':sample_batch})
def home(request):
return render(request, 'home.html',{})
return render(request, 'yeast/home.html',{})
def batch(request, batch_id):
batch = get_object_or_404(Batch, pk=batch_id)