added sort code
This commit is contained in:
@@ -8,7 +8,7 @@ from accounts.models import (
|
||||
IAmPrincipalType,
|
||||
# IAmPrincipalKYCDetails,
|
||||
)
|
||||
from manage_events.models import PrincipalPreference
|
||||
from manage_events.models import EventPrincipalInteraction, PrincipalPreference
|
||||
from manage_referrals.models import (
|
||||
ReferralCode,
|
||||
ReferralRecord,
|
||||
@@ -144,6 +144,8 @@ class ProfileSerializer(serializers.ModelSerializer):
|
||||
has_preferences = serializers.SerializerMethodField(read_only=True)
|
||||
register_complete = serializers.BooleanField(read_only=True)
|
||||
is_active = serializers.BooleanField(read_only=True)
|
||||
going_events_count = serializers.SerializerMethodField(read_only=True)
|
||||
interested_events_count = serializers.SerializerMethodField(read_only=True)
|
||||
|
||||
class Meta:
|
||||
model = IAmPrincipal
|
||||
@@ -165,6 +167,8 @@ class ProfileSerializer(serializers.ModelSerializer):
|
||||
"instagram_profile",
|
||||
"website",
|
||||
"is_active",
|
||||
"going_events_count",
|
||||
"interested_events_count",
|
||||
]
|
||||
|
||||
def update(self, instance, validated_data):
|
||||
@@ -175,6 +179,16 @@ class ProfileSerializer(serializers.ModelSerializer):
|
||||
instance.last_name = validated_data.get("last_name", instance.last_name)
|
||||
return super().update(instance, validated_data)
|
||||
|
||||
def get_going_events_count(self, obj):
|
||||
return EventPrincipalInteraction.objects.filter(
|
||||
principal=obj, status="going"
|
||||
).count()
|
||||
|
||||
def get_interested_events_count(self, obj):
|
||||
return EventPrincipalInteraction.objects.filter(
|
||||
principal=obj, status="interested"
|
||||
).count()
|
||||
|
||||
def get_invite_count(self, obj):
|
||||
if obj:
|
||||
return ReferralRecord.get_invite_count(obj)
|
||||
|
||||
@@ -42,6 +42,9 @@
|
||||
<th class="sorting" tabindex="0" aria-controls="style-3" rowspan="1" colspan="1"
|
||||
aria-label="Mobile No.: activate to sort column ascending"
|
||||
style="width: 98.875px;">Account No</th>
|
||||
<th class="sorting" tabindex="0" aria-controls="style-3" rowspan="1" colspan="1"
|
||||
aria-label="Mobile No.: activate to sort column ascending"
|
||||
style="width: 98.875px;">Sort Code</th>
|
||||
<th class="sorting" tabindex="0" aria-controls="style-3" rowspan="1" colspan="1"
|
||||
aria-label="Mobile No.: activate to sort column ascending"
|
||||
style="width: 98.875px;">First Name</th>
|
||||
@@ -67,6 +70,7 @@
|
||||
<td>{{account_obj.principal}}</td>
|
||||
<td>{{account_obj.principal.principal_type}}</td>
|
||||
<td>{{account_obj.account_no}}</td>
|
||||
<td>{{account_obj.sort_code}}</td>
|
||||
<td>{{account_obj.first_name}}</td>
|
||||
<td>{{account_obj.last_name}}</td>
|
||||
<td class="text-center">
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
<td>{{transaction_obj.payment_method}}</td>
|
||||
<td>{{transaction_obj.transaction_status}}</td>
|
||||
<td>{{transaction_obj.amount}}</td>
|
||||
<td>{{transaction_obj.coin}}</td>
|
||||
<td>{{transaction_obj.coins}}</td>
|
||||
<td>{{transaction_obj.created_on}}</td>
|
||||
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user