Rename yeast batch to propogation.
Refrences to yeast `batches` are now `propogations`. Hopefully less confusing now... Closes #6
This commit is contained in:
@ -2,15 +2,15 @@ from django.contrib import admin
|
||||
from django.urls import reverse
|
||||
from django.utils.html import format_html
|
||||
from django.apps import apps
|
||||
from yeast.models import Yeast, Strain, Manufacturer, Storage, Batch
|
||||
from yeast.models import Yeast, Strain, Manufacturer, Storage, Propogation
|
||||
from yeast.forms import YeastModelForm
|
||||
|
||||
import beer
|
||||
|
||||
from config.extras import BREWFATHER_APP_ROOT
|
||||
|
||||
class BatchInline(admin.TabularInline):
|
||||
model = Batch
|
||||
class PropogationInline(admin.TabularInline):
|
||||
model = Propogation
|
||||
extra = 0
|
||||
|
||||
class SampleInline(admin.TabularInline):
|
||||
@ -23,11 +23,11 @@ class StrainInline(admin.TabularInline):
|
||||
|
||||
class ParentInline(admin.TabularInline):
|
||||
verbose_name = 'Parent Samples'
|
||||
model = Batch.parent.through
|
||||
model = Propogation.parent.through
|
||||
|
||||
@admin.register(Yeast)
|
||||
class YeastAdmin(admin.ModelAdmin):
|
||||
list_display = [ 'batch', 'url', 'lot_number', 'age', 'storage', 'viability', 'generation_num', 'cellcount', 'pitched', 'date_pitched', 'pitched_batch']
|
||||
list_display = [ 'propogation', 'url', 'lot_number', 'age', 'storage', 'viability', 'generation_num', 'cellcount', 'pitched', 'date_pitched', 'pitched_batch']
|
||||
list_editable = ['pitched', 'date_pitched', 'pitched_batch', 'lot_number']
|
||||
|
||||
def batch_url(self, obj):
|
||||
@ -43,7 +43,7 @@ class YeastAdmin(admin.ModelAdmin):
|
||||
class StrainAdmin(admin.ModelAdmin):
|
||||
list_display = ['name', 'long_name', 'manufacturer', 'avilable_batches']
|
||||
inlines = [
|
||||
BatchInline,
|
||||
PropogationInline,
|
||||
]
|
||||
list_editable = ['long_name', 'manufacturer']
|
||||
|
||||
@ -58,7 +58,7 @@ class StrainAdmin(admin.ModelAdmin):
|
||||
urls.append('<a href="{}">{}</a>'.format(url, url_text))
|
||||
return format_html(', '.join(urls))
|
||||
|
||||
avilable_batches.short_description = 'Available Batches'
|
||||
avilable_batches.short_description = 'Available Propogation'
|
||||
|
||||
@admin.register(Storage)
|
||||
class StorageAdmin(admin.ModelAdmin):
|
||||
@ -78,8 +78,8 @@ class ManufacturerAdmin(admin.ModelAdmin):
|
||||
if obj.website:
|
||||
return format_html("<a href='{url}'>{url}</a>", url=obj.website)
|
||||
|
||||
@admin.register(Batch)
|
||||
class BatchAdmin(admin.ModelAdmin):
|
||||
@admin.register(Propogation)
|
||||
class PropogationAdmin(admin.ModelAdmin):
|
||||
list_display = ['strain', 'consumed', 'source', 'parent_samples', 'production_date', 'avilable_samples', 'used_samples']
|
||||
form = YeastModelForm
|
||||
filter_horizontal = ['parent']
|
||||
@ -89,7 +89,7 @@ class BatchAdmin(admin.ModelAdmin):
|
||||
]
|
||||
|
||||
def save_related(self, request, form, formsets, change):
|
||||
super(BatchAdmin, self).save_related(request, form, formsets, change)
|
||||
super(PropogationAdmin, self).save_related(request, form, formsets, change)
|
||||
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:
|
||||
|
Reference in New Issue
Block a user