Compare commits
3 Commits
4c6fe9824d
...
90b613c433
Author | SHA1 | Date | |
---|---|---|---|
|
90b613c433 | ||
|
c70b326c37 | ||
|
be3eb2fefe |
@ -8,10 +8,6 @@ from yeast.models import Yeast
|
||||
|
||||
from config.extras import BREWFATHER_APP_ROOT
|
||||
|
||||
import logging
|
||||
logger = logging.getLogger('django')
|
||||
|
||||
|
||||
class SampleInline(admin.TabularInline):
|
||||
model = Yeast
|
||||
extra = 0
|
||||
@ -44,4 +40,4 @@ for model_name, model in app.models.items():
|
||||
try:
|
||||
admin.site.register(model)
|
||||
except admin.exceptions.AlreadyRegistered:
|
||||
logger.critical(model)
|
||||
pass
|
||||
|
@ -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
10
beer/views.py
Normal 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()})
|
@ -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),
|
||||
|
@ -3,15 +3,8 @@ from django.utils.html import format_html
|
||||
from django.apps import apps
|
||||
from django import forms
|
||||
|
||||
import logging
|
||||
logger = logging.getLogger('django')
|
||||
|
||||
from equipment.models import Equipment, KegType, State, EquipmentMaintenanceLine, EquipmentMaintenance
|
||||
|
||||
import logging
|
||||
logger = logging.getLogger('django')
|
||||
|
||||
|
||||
class AdminCreateFormMixin:
|
||||
"""
|
||||
Mixin to easily use a different form for the create case (in comparison to "edit") in the django admin
|
||||
@ -70,4 +63,4 @@ for model_name, model in app.models.items():
|
||||
try:
|
||||
admin.site.register(model)
|
||||
except admin.exceptions.AlreadyRegistered:
|
||||
logger.critical(model)
|
||||
pass
|
||||
|
@ -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 %}
|
||||
|
@ -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
|
||||
|
||||
|
@ -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 »</a></p>
|
||||
<p><a class="btn btn-secondary" href="{% url 'yeast:home' %}" role="button">Go »</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 »</a></p>
|
||||
<p><a class="btn btn-secondary" href="{% url 'equipment:home' %}" role="button">Go »</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 »</a></p>
|
||||
<p><a class="btn btn-secondary" href="{% url 'beer:home' %}" role="button">Go »</a></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -9,9 +9,6 @@ import beer
|
||||
|
||||
from config.extras import BREWFATHER_APP_ROOT
|
||||
|
||||
import logging
|
||||
logger = logging.getLogger('django')
|
||||
|
||||
class BatchInline(admin.TabularInline):
|
||||
model = Batch
|
||||
extra = 0
|
||||
@ -96,7 +93,6 @@ class BatchAdmin(admin.ModelAdmin):
|
||||
if form.instance.source_batch:
|
||||
relate_samples = [x for x in Yeast.objects.all() if x.pitched_batch==form.instance.source_batch]
|
||||
for sample in relate_samples:
|
||||
logger.critical(sample)
|
||||
form.instance.parent.add(sample)
|
||||
|
||||
def parent_samples(self, obj):
|
||||
@ -133,4 +129,4 @@ for model_name, model in app.models.items():
|
||||
try:
|
||||
admin.site.register(model)
|
||||
except admin.exceptions.AlreadyRegistered:
|
||||
logger.critical(model)
|
||||
pass
|
||||
|
@ -9,14 +9,19 @@
|
||||
<div class="container">
|
||||
|
||||
<h1>{{ batch.strain.name }}</h1>
|
||||
<b>Source: {{ batch.get_source_display }}
|
||||
<b>Source:</b> {{ batch.get_source_display }}
|
||||
{% if batch.source_batch %}
|
||||
from <a href="{{ batch.beer_url }}" target="_blank" rel="noopener noreferrer">#{{ batch.beer_num }}: {{ batch.beer_name }}</a>
|
||||
{% endif %}
|
||||
{% endif %}<br>
|
||||
|
||||
{% if batch.parent.all %} <b>Parents:</b>{% endif %}
|
||||
{% for parent in batch.parent.all %}
|
||||
<a href="{% url 'yeast:batch' parent.batch.id %}">{{ parent.batch.id}}</a>{% if not forloop.last %},{% endif %}
|
||||
{% endfor %}
|
||||
</b>
|
||||
<p><p>
|
||||
|
||||
</div> <!-- /container -->
|
||||
</div> <!-- /container -->
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-6 form-group">
|
||||
|
@ -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'),
|
||||
]
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user