Skip to content
This repository has been archived by the owner on Jul 18, 2023. It is now read-only.

Commit

Permalink
Add Final Concentrated Sample Volume fields to Sample serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronstephenson committed Aug 24, 2017
1 parent 4b91424 commit 8e82af7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lideservices/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@ class FinalConcentratedSampleVolume(HistoryModel):
Final Concentrated Sample Volume
"""

sample = models.ForeignKey('Sample')
concentration_type = models.ForeignKey('ConcentrationType')
sample = models.ForeignKey('Sample', related_name='final_concentrated_sample_volumes')
concentration_type = models.ForeignKey('ConcentrationType', related_name='final_concentrated_sample_volumes')
final_concentrated_sample_volume = models.FloatField(null=True, blank=True)
final_concentrated_sample_volume_notes = models.TextField(blank=True)

Expand Down
15 changes: 12 additions & 3 deletions lideservices/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@

class SampleSerializer(serializers.ModelSerializer):

final_concentrated_sample_volume = serializers.FloatField(
source='final_concentrated_sample_volumes.final_concentrated_sample_volume', read_only=True)
final_concentrated_sample_volume_type = serializers.StringRelatedField(
source='final_concentrated_sample_volumes.concentration_type', read_only=True)
final_concentrated_sample_volume_notes = serializers.CharField(
source='final_concentrated_sample_volumes.final_concentrated_sample_volume_notes', read_only=True)

class Meta:
model = Sample
fields = ('id', 'sample_type', 'matrix_type', 'filter_type', 'study', 'study_site_name',
Expand All @@ -20,14 +27,16 @@ class Meta:
'total_volume_sampled_initial', 'total_volume_sampled_unit_initial', 'total_volume_sampled',
'sample_volume_initial', 'sample_volume_filtered', 'filter_born_on_date', 'filter_flag',
'secondary_concentration_flag', 'elution_date', 'elution_notes', 'technician_initials',
'air_subsample_volume', 'post_dilution_volume', 'pump_flow_rate', 'analysisbatches',)
'air_subsample_volume', 'post_dilution_volume', 'pump_flow_rate', 'analysisbatches',
'final_concentrated_sample_volume', 'final_concentrated_sample_volume_type',
'final_concentrated_sample_volume_notes',)


class AliquotSerializer(serializers.ModelSerializer):

class Meta:
model = Aliquot
fields = ('id', 'sample', 'aliquot', 'frozen', 'freezer_location')
fields = ('id', 'sample', 'aliquot', 'frozen', 'freezer_location',)


class SampleTypeSerializer(serializers.ModelSerializer):
Expand Down Expand Up @@ -76,7 +85,7 @@ class FreezerLocationSerializer(serializers.ModelSerializer):

class Meta:
model = FreezerLocation
fields = ('id', 'freezer', 'rack', 'box', 'row', 'spot')
fields = ('id', 'freezer', 'rack', 'box', 'row', 'spot',)


class FreezerSerializer(serializers.ModelSerializer):
Expand Down

0 comments on commit 8e82af7

Please sign in to comment.