TST: Travis/Coveralls setup ()

- add travis.yml
- linting
- coveralls
- readme
This commit is contained in:
Matthew Ryan Dillon 2016-08-28 16:30:20 -07:00
parent 8622e2323d
commit 983ce6f021
15 changed files with 107 additions and 50 deletions
ccdb/experiments

View file

@ -1,7 +1,7 @@
from django.contrib import admin
from .models import Flaw, Experiment, ProtocolAttachment, TreatmentType, \
Treatment, TreatmentReplicate, AliveDeadCount
from .models import (Flaw, Experiment, ProtocolAttachment, TreatmentType,
Treatment, TreatmentReplicate, AliveDeadCount)
class FlawAdmin(admin.ModelAdmin):
@ -17,7 +17,8 @@ class ExperimentAdmin(admin.ModelAdmin):
list_display_links = ('name',)
search_fields = ('name', 'code', 'description', 'flaw', 'sort_order')
list_per_page = 25
fields = ('name', 'code', 'description', 'flaw', 'collections', 'sort_order')
fields = ('name', 'code', 'description', 'flaw', 'collections',
'sort_order')
class ProtocolAttachmentAdmin(admin.ModelAdmin):
@ -30,46 +31,46 @@ class ProtocolAttachmentAdmin(admin.ModelAdmin):
class TreatmentTypeAdmin(admin.ModelAdmin):
list_display = ('experiment', 'name', 'code', 'treatment_type',
'placement', 'description', 'sort_order')
'placement', 'description', 'sort_order')
list_display_links = ('name',)
search_fields = ('experiment', 'name', 'code', 'treatment_type',
'placement', 'description')
'placement', 'description')
list_per_page = 25
fields = ('experiment', 'name', 'code', 'treatment_type', 'placement',
'description', 'sort_order')
'description', 'sort_order')
class TreatmentAdmin(admin.ModelAdmin):
list_display = ('treatment_type', 'container', 'study_location', 'species',
'sex', 'flaw')
'sex', 'flaw')
list_display_links = ('treatment_type',)
search_fields = ('treatment_type', 'container', 'study_location', 'species',
'sex', 'flaw')
search_fields = ('treatment_type', 'container', 'study_location',
'species', 'sex', 'flaw')
list_per_page = 25
fields = ('treatment_type', 'container', 'study_location', 'species',
'sex', 'flaw')
'sex', 'flaw')
class TreatmentReplicateAdmin(admin.ModelAdmin):
list_display = ('treatment', 'name', 'setup_date', 'setup_time',
'setup_sample_size', 'mass_g', 'flaw')
'setup_sample_size', 'mass_g', 'flaw')
list_display_links = ('name',)
search_fields = ('treatment', 'name', 'setup_date', 'setup_time',
'setup_sample_size', 'mass_g', 'flaw')
'setup_sample_size', 'mass_g', 'flaw')
list_per_page = 25
fields = ('treatment', 'name', 'setup_date', 'setup_time',
'setup_sample_size', 'mass_g', 'flaw')
'setup_sample_size', 'mass_g', 'flaw')
class AliveDeadCountAdmin(admin.ModelAdmin):
list_display = ('treatment', 'tr', 'status_date',
'status_time', 'count_alive', 'count_dead', 'flaw')
list_display = ('treatment', 'tr', 'status_date', 'status_time',
'count_alive', 'count_dead', 'flaw')
list_display_links = ('status_date',)
search_fields = ('treatment_replicate', 'status_date', 'status_time',
'count_alive', 'count_dead', 'flaw')
'count_alive', 'count_dead', 'flaw')
list_per_page = 25
fields = ('treatment_replicate', 'status_date', 'status_time',
'count_alive', 'count_dead', 'flaw')
'count_alive', 'count_dead', 'flaw')
def treatment(self, obj):
return obj.treatment_replicate.treatment
@ -77,8 +78,8 @@ class AliveDeadCountAdmin(admin.ModelAdmin):
def tr(self, obj):
return "{}_{}_{}".format(obj.treatment_replicate.setup_date,
obj.treatment_replicate.name,
obj.treatment_replicate.setup_sample_size)
obj.treatment_replicate.name,
obj.treatment_replicate.setup_sample_size)
tr.short_description = 'Treatment Replicate'

View file

@ -17,7 +17,8 @@ class Experiment(models.Model):
name = models.CharField(max_length=150)
code = models.CharField(max_length=10, blank=True)
description = models.CharField(max_length=255, blank=True)
flaw = models.ForeignKey(Flaw, blank=True, null=True, related_name='experiments')
flaw = models.ForeignKey(Flaw, blank=True, null=True,
related_name='experiments')
sort_order = models.IntegerField(blank=True, null=True)
collections = models.ManyToManyField('collections_ccdb.Collection')
@ -63,19 +64,22 @@ class TreatmentType(models.Model):
class Treatment(models.Model):
treatment_type = models.ForeignKey(TreatmentType, related_name='treatments')
treatment_type = models.ForeignKey(TreatmentType,
related_name='treatments')
container = models.ForeignKey('misc.Container', blank=True, null=True,
related_name='treatments')
study_location = models.ForeignKey('locations.StudyLocation',
related_name='treatments')
species = models.ForeignKey('species.Species', related_name='treatments')
sex = models.CharField(max_length=25)
flaw = models.ForeignKey(Flaw, blank=True, null=True, related_name='treatments')
flaw = models.ForeignKey(Flaw, blank=True, null=True,
related_name='treatments')
display_name = models.CharField(max_length=255, editable=False)
def save(self, *args, **kwargs):
self.display_name = "{}_{}_{}_{}".format(self.treatment_type,
self.study_location, self.species,
self.study_location,
self.species,
self.sex)
super(Treatment, self).save(*args, **kwargs)
@ -88,13 +92,15 @@ class Treatment(models.Model):
class TreatmentReplicate(models.Model):
treatment = models.ForeignKey(Treatment, related_name='treatment_replicates')
treatment = models.ForeignKey(Treatment,
related_name='treatment_replicates')
name = models.CharField(max_length=50)
setup_date = models.DateField(blank=True, null=True)
setup_time = models.TimeField(blank=True, null=True)
setup_sample_size = models.IntegerField(blank=True, null=True)
mass_g = models.FloatField(blank=True, null=True)
flaw = models.ForeignKey(Flaw, blank=True, null=True, related_name='treatment_replicates')
flaw = models.ForeignKey(Flaw, blank=True, null=True,
related_name='treatment_replicates')
display_name = models.CharField(max_length=255, editable=False)
def save(self, *args, **kwargs):