chore [P-01]: подтянул бэк
This commit is contained in:
commit
5cfd97b037
1 file changed
+12
@@ -102,10 +102,22 @@ class TestResultSerializer(serializers.ModelSerializer):
|
||||
|
||||
|
||||
class TestsSerializer(serializers.ModelSerializer):
|
||||
dateend = serializers.SerializerMethodField()
|
||||
|
||||
class Meta:
|
||||
model = Test
|
||||
fields = '__all__'
|
||||
|
||||
def get_dateend(self, obj):
|
||||
user = self.context['request'].user
|
||||
if not user.is_authenticated:
|
||||
return None
|
||||
|
||||
testing = Testing.objects.filter(test=obj, user=user).order_by('-completion_date').first()
|
||||
if testing and testing.completion_date:
|
||||
return testing.completion_date
|
||||
return None
|
||||
|
||||
def create(self, validated_data):
|
||||
user = self.context['request'].user
|
||||
if user.is_authenticated:
|
||||
|
||||
Reference in new issue
Block a user