diff --git a/account/migrations/0012_userprofile_language.py b/account/migrations/0012_userprofile_language.py new file mode 100644 index 00000000..a8794886 --- /dev/null +++ b/account/migrations/0012_userprofile_language.py @@ -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), + ), + ] diff --git a/account/models.py b/account/models.py index b2b2c21d..eac1a62d 100644 --- a/account/models.py +++ b/account/models.py @@ -94,6 +94,7 @@ class UserProfile(models.Model): github = models.TextField(null=True) school = models.TextField(null=True) major = models.TextField(null=True) + language = models.TextField(null=True) # for ACM accepted_number = models.IntegerField(default=0) # for OI diff --git a/account/serializers.py b/account/serializers.py index 710de0ff..21ae24aa 100644 --- a/account/serializers.py +++ b/account/serializers.py @@ -105,6 +105,7 @@ class EditUserProfileSerializer(serializers.Serializer): github = 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) + language = serializers.CharField(max_length=32, allow_blank=True, required=False) class ApplyResetPasswordSerializer(serializers.Serializer): diff --git a/account/tests.py b/account/tests.py index 7ca7e810..65e765da 100644 --- a/account/tests.py +++ b/account/tests.py @@ -252,12 +252,13 @@ class UserProfileAPITest(APITestCase): def test_update_profile(self): 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) self.assertSuccess(resp) data = resp.data["data"] self.assertEqual(data["real_name"], "zemal") self.assertEqual(data["submission_number"], 0) + self.assertEqual(data["language"], "en-US") class TwoFactorAuthAPITest(APITestCase): diff --git a/deploy/requirements.txt b/deploy/requirements.txt index 554250a8..75827ffd 100644 --- a/deploy/requirements.txt +++ b/deploy/requirements.txt @@ -12,8 +12,8 @@ qrcode flake8-coding requests django-redis -psycopg2 +psycopg2-binary gunicorn jsonfield XlsxWriter -raven \ No newline at end of file +raven diff --git a/docs/data.json b/docs/data.json index d9dede59..854d63be 100644 --- a/docs/data.json +++ b/docs/data.json @@ -1,11 +1,21 @@ { "update": [ + { + "version": "2018-07-15", + "level": "Recommend", + "title": "Update at 2018-07-15", + "details": [ + "Add Traditional Chinese, by xdavidwu", + "Fix a bug in the navigation bar", + "Move language switch to profile settings page" + ] + }, { "version": "2018-06-02", "level": "Recommend", "title": "Update at 2018-06-02", "details": [ - "Add Chinese, by hirCodd", + "Add Simple Chinese, by hirCodd", "Integrate with katex", "Update libraries to latest version", "The first page in management is changed to dashboard"