Skip to content
This repository has been archived by the owner on Aug 24, 2022. It is now read-only.

Commit

Permalink
mark library preparation, sequencing costs as obsolete
Browse files Browse the repository at this point in the history
  • Loading branch information
risufaj committed Nov 21, 2018
1 parent edacf01 commit 77e6db4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions invoicing/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ def __str__(self):


class LibraryPreparationCosts(models.Model):
library_protocol = models.OneToOneField(LibraryProtocol)
library_protocol = models.ForeignKey(LibraryProtocol,unique=True,limit_choices_to={'obsolete':1})
#library_protocol = models.OneToOneField(LibraryProtocol)
price = models.DecimalField(max_digits=8, decimal_places=2)

class Meta:
Expand All @@ -57,7 +58,7 @@ def __str__(self):


class SequencingCosts(models.Model):
sequencer = models.ForeignKey(Sequencer)
sequencer = models.ForeignKey(Sequencer,limit_choices_to={'obsolete':1})
read_length = models.ForeignKey(ReadLength, verbose_name='Read Length')
price = models.DecimalField(max_digits=8, decimal_places=2)

Expand Down
6 changes: 3 additions & 3 deletions invoicing/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ class FixedCostsViewSet(mixins.UpdateModelMixin,
viewsets.ReadOnlyModelViewSet):
""" Get the list of Fixed Costs. """
permission_classes = [IsAdminUser]
queryset = FixedCosts.objects.all()
queryset = FixedCosts.objects.filter(sequencer__obsolete = settings.NON_OBSOLETE)
serializer_class = FixedCostsSerializer


Expand All @@ -290,7 +290,7 @@ class LibraryPreparationCostsViewSet(mixins.UpdateModelMixin,
""" Get the list of Library Preparation Costs. """

permission_classes = [IsAdminUser]
queryset = LibraryPreparationCosts.objects.all()
queryset = LibraryPreparationCosts.objects.filter(library_protocol__obsolete=settings.NON_OBSOLETE)
print(queryset.query)

serializer_class = LibraryPreparationCostsSerializer
Expand All @@ -301,5 +301,5 @@ class SequencingCostsViewSet(mixins.UpdateModelMixin,
viewsets.ReadOnlyModelViewSet):
""" Get the list of Sequencing Costs. """
permission_classes = [IsAdminUser]
queryset = SequencingCosts.objects.all()
queryset = SequencingCosts.objects.filter(sequencer__obsolete=settings.NON_OBSOLETE)
serializer_class = SequencingCostsSerializer

0 comments on commit 77e6db4

Please sign in to comment.