mirror of
https://github.com/QingdaoU/OnlineJudge.git
synced 2024-12-28 16:12:13 +00:00
Added: language profile
This commit is contained in:
parent
50c8487a50
commit
93cb2bc3fe
20
account/migrations/0012_userprofile_language.py
Normal file
20
account/migrations/0012_userprofile_language.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.11.4 on 2018-07-15 02:06
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('account', '0011_auto_20180501_0456'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='userprofile',
|
||||||
|
name='language',
|
||||||
|
field=models.TextField(null=True),
|
||||||
|
),
|
||||||
|
]
|
@ -94,6 +94,7 @@ class UserProfile(models.Model):
|
|||||||
github = models.TextField(null=True)
|
github = models.TextField(null=True)
|
||||||
school = models.TextField(null=True)
|
school = models.TextField(null=True)
|
||||||
major = models.TextField(null=True)
|
major = models.TextField(null=True)
|
||||||
|
language = models.TextField(null=True)
|
||||||
# for ACM
|
# for ACM
|
||||||
accepted_number = models.IntegerField(default=0)
|
accepted_number = models.IntegerField(default=0)
|
||||||
# for OI
|
# for OI
|
||||||
|
@ -105,6 +105,7 @@ class EditUserProfileSerializer(serializers.Serializer):
|
|||||||
github = serializers.CharField(max_length=64, allow_blank=True, required=False)
|
github = serializers.CharField(max_length=64, allow_blank=True, required=False)
|
||||||
school = serializers.CharField(max_length=64, allow_blank=True, required=False)
|
school = serializers.CharField(max_length=64, allow_blank=True, required=False)
|
||||||
major = serializers.CharField(max_length=64, allow_blank=True, required=False)
|
major = serializers.CharField(max_length=64, allow_blank=True, required=False)
|
||||||
|
language = serializers.CharField(max_length=32, allow_blank=True, required=False)
|
||||||
|
|
||||||
|
|
||||||
class ApplyResetPasswordSerializer(serializers.Serializer):
|
class ApplyResetPasswordSerializer(serializers.Serializer):
|
||||||
|
@ -252,12 +252,13 @@ class UserProfileAPITest(APITestCase):
|
|||||||
|
|
||||||
def test_update_profile(self):
|
def test_update_profile(self):
|
||||||
self.create_user("test", "test123")
|
self.create_user("test", "test123")
|
||||||
update_data = {"real_name": "zemal", "submission_number": 233}
|
update_data = {"real_name": "zemal", "submission_number": 233, "language": "en-US"}
|
||||||
resp = self.client.put(self.url, data=update_data)
|
resp = self.client.put(self.url, data=update_data)
|
||||||
self.assertSuccess(resp)
|
self.assertSuccess(resp)
|
||||||
data = resp.data["data"]
|
data = resp.data["data"]
|
||||||
self.assertEqual(data["real_name"], "zemal")
|
self.assertEqual(data["real_name"], "zemal")
|
||||||
self.assertEqual(data["submission_number"], 0)
|
self.assertEqual(data["submission_number"], 0)
|
||||||
|
self.assertEqual(data["language"], "en-US")
|
||||||
|
|
||||||
|
|
||||||
class TwoFactorAuthAPITest(APITestCase):
|
class TwoFactorAuthAPITest(APITestCase):
|
||||||
|
Loading…
Reference in New Issue
Block a user