Retally membership months on any transaction change
This commit is contained in:
parent
73b6d19c19
commit
712a6c533f
|
@ -9,7 +9,7 @@ from rest_auth.registration.views import RegisterView
|
||||||
from fuzzywuzzy import fuzz, process
|
from fuzzywuzzy import fuzz, process
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
from . import models, serializers
|
from . import models, serializers, utils
|
||||||
|
|
||||||
class AllowMetadata(BasePermission):
|
class AllowMetadata(BasePermission):
|
||||||
def has_permission(self, request, view):
|
def has_permission(self, request, view):
|
||||||
|
@ -197,8 +197,18 @@ class TransactionViewSet(Base, Create, Retrieve, Update):
|
||||||
queryset = models.Transaction.objects.all()
|
queryset = models.Transaction.objects.all()
|
||||||
serializer_class = serializers.TransactionSerializer
|
serializer_class = serializers.TransactionSerializer
|
||||||
|
|
||||||
|
def retally_membership(self):
|
||||||
|
member_id = self.request.data['member_id']
|
||||||
|
member = get_object_or_404(models.Member, id=member_id)
|
||||||
|
utils.tally_membership_months(member)
|
||||||
|
|
||||||
def perform_create(self, serializer):
|
def perform_create(self, serializer):
|
||||||
serializer.save(recorder=self.request.user)
|
serializer.save(recorder=self.request.user)
|
||||||
|
self.retally_membership()
|
||||||
|
|
||||||
|
def perform_update(self, serializer):
|
||||||
|
serializer.save()
|
||||||
|
self.retally_membership()
|
||||||
|
|
||||||
|
|
||||||
class UserView(views.APIView):
|
class UserView(views.APIView):
|
||||||
|
|
|
@ -40,7 +40,7 @@ function ClassTable(props) {
|
||||||
</Table.Row>
|
</Table.Row>
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
<p>None</p>
|
<Table.Row><Table.Cell>None</Table.Cell></Table.Row>
|
||||||
}
|
}
|
||||||
</Table.Body>
|
</Table.Body>
|
||||||
</Table>
|
</Table>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user