Merge branch 'master' into edit_link

This commit is contained in:
Phuoc Dinh Le 2022-10-20 01:04:13 -05:00 committed by GitHub
commit 572026aecd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 867 additions and 229 deletions

View file

@ -1,17 +0,0 @@
name: build
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install flake8
run: pip install flake8 flake8-import-order flake8-future-import flake8-commas flake8-logging-format
- name: Lint with flake8
run: |
flake8 --version
flake8

View file

@ -1,40 +0,0 @@
name: compilemessages
on:
push:
paths:
- 'locale/**'
pull_request:
paths:
- 'locale/**'
jobs:
compilemessages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Checkout submodules
run: |
git submodule init
git submodule update
- name: Install requirements
run: |
sudo apt-get install gettext
pip install -r requirements.txt
pip install pymysql
- name: Check .po file validity
run: |
fail=0
while read -r file; do
if ! msgfmt --check-format "$file"; then
fail=$((fail + 1))
fi
done < <(find locale -name '*.po')
exit "$fail"
shell: bash
- name: Compile messages
run: |
echo "STATIC_ROOT = '/tmp'" > dmoj/local_settings.py
python manage.py compilemessages

View file

@ -1,53 +0,0 @@
name: makemessages
on:
push:
branches:
- master
jobs:
makemessages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Checkout submodules
run: |
git submodule init
git submodule update
- name: Install requirements
run: |
sudo apt-get install gettext
curl -O https://artifacts.crowdin.com/repo/deb/crowdin.deb
sudo dpkg -i crowdin.deb
pip install -r requirements.txt
pip install pymysql
- name: Collect localizable strings
run: |
echo "STATIC_ROOT = '/tmp'" > dmoj/local_settings.py
python manage.py makemessages -l en -e py,html,txt
python manage.py makemessages -l en -d djangojs
- name: Upload strings to Crowdin
env:
CROWDIN_API_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }}
run: |
cat > crowdin.yaml <<EOF
project_identifier: dmoj
files:
- source: /locale/en/LC_MESSAGES/django.po
translation: /locale/%two_letters_code%/LC_MESSAGES/django.po
languages_mapping:
two_letters_code:
zh-CN: zh_Hans
sr-CS: sr_Latn
- source: /locale/en/LC_MESSAGES/djangojs.po
translation: /locale/%two_letters_code%/LC_MESSAGES/djangojs.po
languages_mapping:
two_letters_code:
zh-CN: zh_Hans
sr-CS: sr_Latn
EOF
echo "api_key: ${CROWDIN_API_TOKEN}" >> crowdin.yaml
crowdin upload sources

View file

@ -1,67 +0,0 @@
name: updatemessages
on:
schedule:
- cron: '0 * * * *'
jobs:
updatemessages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Checkout submodules
run: |
git submodule init
git submodule update
- name: Install requirements
run: |
sudo apt-get install gettext
curl -O https://artifacts.crowdin.com/repo/deb/crowdin.deb
sudo dpkg -i crowdin.deb
pip install -r requirements.txt
pip install pymysql
- name: Download strings from Crowdin
env:
CROWDIN_API_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }}
run: |
cat > crowdin.yaml <<EOF
project_identifier: dmoj
files:
- source: /locale/en/LC_MESSAGES/django.po
translation: /locale/%two_letters_code%/LC_MESSAGES/django.po
languages_mapping:
two_letters_code:
zh-CN: zh_Hans
zh-TW: zh_Hant
sr-CS: sr_Latn
- source: /locale/en/LC_MESSAGES/djangojs.po
translation: /locale/%two_letters_code%/LC_MESSAGES/djangojs.po
languages_mapping:
two_letters_code:
zh-CN: zh_Hans
zh-TW: zh_Hant
sr-CS: sr_Latn
EOF
echo "api_key: ${CROWDIN_API_TOKEN}" >> crowdin.yaml
crowdin download
rm crowdin.yaml
- name: Cleanup
run: |
rm -rf src/
git add locale
git checkout .
git clean -fd
- name: Create pull request
uses: peter-evans/create-pull-request@v1.4.1-multi
env:
GITHUB_TOKEN: ${{ secrets.REPO_SCOPED_TOKEN }}
COMMIT_MESSAGE: 'i18n: update translations from Crowdin'
PULL_REQUEST_TITLE: 'Update translations from Crowdin'
PULL_REQUEST_BODY: This PR has been auto-generated to pull in latest translations from [Crowdin](https://translate.dmoj.ca).
PULL_REQUEST_LABELS: i18n, enhancement
PULL_REQUEST_REVIEWERS: Xyene, quantum5
PULL_REQUEST_BRANCH: update-i18n
BRANCH_SUFFIX: none

View file

@ -0,0 +1,707 @@
# Generated by Django 2.2.28 on 2022-10-17 18:24
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("judge", "0133_auto_20221013_0850"),
]
operations = [
migrations.AlterField(
model_name="profile",
name="timezone",
field=models.CharField(
choices=[
(
"Africa",
[
("Africa/Abidjan", "Abidjan"),
("Africa/Accra", "Accra"),
("Africa/Addis_Ababa", "Addis_Ababa"),
("Africa/Algiers", "Algiers"),
("Africa/Asmara", "Asmara"),
("Africa/Asmera", "Asmera"),
("Africa/Bamako", "Bamako"),
("Africa/Bangui", "Bangui"),
("Africa/Banjul", "Banjul"),
("Africa/Bissau", "Bissau"),
("Africa/Blantyre", "Blantyre"),
("Africa/Brazzaville", "Brazzaville"),
("Africa/Bujumbura", "Bujumbura"),
("Africa/Cairo", "Cairo"),
("Africa/Casablanca", "Casablanca"),
("Africa/Ceuta", "Ceuta"),
("Africa/Conakry", "Conakry"),
("Africa/Dakar", "Dakar"),
("Africa/Dar_es_Salaam", "Dar_es_Salaam"),
("Africa/Djibouti", "Djibouti"),
("Africa/Douala", "Douala"),
("Africa/El_Aaiun", "El_Aaiun"),
("Africa/Freetown", "Freetown"),
("Africa/Gaborone", "Gaborone"),
("Africa/Harare", "Harare"),
("Africa/Johannesburg", "Johannesburg"),
("Africa/Juba", "Juba"),
("Africa/Kampala", "Kampala"),
("Africa/Khartoum", "Khartoum"),
("Africa/Kigali", "Kigali"),
("Africa/Kinshasa", "Kinshasa"),
("Africa/Lagos", "Lagos"),
("Africa/Libreville", "Libreville"),
("Africa/Lome", "Lome"),
("Africa/Luanda", "Luanda"),
("Africa/Lubumbashi", "Lubumbashi"),
("Africa/Lusaka", "Lusaka"),
("Africa/Malabo", "Malabo"),
("Africa/Maputo", "Maputo"),
("Africa/Maseru", "Maseru"),
("Africa/Mbabane", "Mbabane"),
("Africa/Mogadishu", "Mogadishu"),
("Africa/Monrovia", "Monrovia"),
("Africa/Nairobi", "Nairobi"),
("Africa/Ndjamena", "Ndjamena"),
("Africa/Niamey", "Niamey"),
("Africa/Nouakchott", "Nouakchott"),
("Africa/Ouagadougou", "Ouagadougou"),
("Africa/Porto-Novo", "Porto-Novo"),
("Africa/Sao_Tome", "Sao_Tome"),
("Africa/Timbuktu", "Timbuktu"),
("Africa/Tripoli", "Tripoli"),
("Africa/Tunis", "Tunis"),
("Africa/Windhoek", "Windhoek"),
],
),
(
"America",
[
("America/Adak", "Adak"),
("America/Anchorage", "Anchorage"),
("America/Anguilla", "Anguilla"),
("America/Antigua", "Antigua"),
("America/Araguaina", "Araguaina"),
(
"America/Argentina/Buenos_Aires",
"Argentina/Buenos_Aires",
),
("America/Argentina/Catamarca", "Argentina/Catamarca"),
(
"America/Argentina/ComodRivadavia",
"Argentina/ComodRivadavia",
),
("America/Argentina/Cordoba", "Argentina/Cordoba"),
("America/Argentina/Jujuy", "Argentina/Jujuy"),
("America/Argentina/La_Rioja", "Argentina/La_Rioja"),
("America/Argentina/Mendoza", "Argentina/Mendoza"),
(
"America/Argentina/Rio_Gallegos",
"Argentina/Rio_Gallegos",
),
("America/Argentina/Salta", "Argentina/Salta"),
("America/Argentina/San_Juan", "Argentina/San_Juan"),
("America/Argentina/San_Luis", "Argentina/San_Luis"),
("America/Argentina/Tucuman", "Argentina/Tucuman"),
("America/Argentina/Ushuaia", "Argentina/Ushuaia"),
("America/Aruba", "Aruba"),
("America/Asuncion", "Asuncion"),
("America/Atikokan", "Atikokan"),
("America/Atka", "Atka"),
("America/Bahia", "Bahia"),
("America/Bahia_Banderas", "Bahia_Banderas"),
("America/Barbados", "Barbados"),
("America/Belem", "Belem"),
("America/Belize", "Belize"),
("America/Blanc-Sablon", "Blanc-Sablon"),
("America/Boa_Vista", "Boa_Vista"),
("America/Bogota", "Bogota"),
("America/Boise", "Boise"),
("America/Buenos_Aires", "Buenos_Aires"),
("America/Cambridge_Bay", "Cambridge_Bay"),
("America/Campo_Grande", "Campo_Grande"),
("America/Cancun", "Cancun"),
("America/Caracas", "Caracas"),
("America/Catamarca", "Catamarca"),
("America/Cayenne", "Cayenne"),
("America/Cayman", "Cayman"),
("America/Chicago", "Chicago"),
("America/Chihuahua", "Chihuahua"),
("America/Coral_Harbour", "Coral_Harbour"),
("America/Cordoba", "Cordoba"),
("America/Costa_Rica", "Costa_Rica"),
("America/Creston", "Creston"),
("America/Cuiaba", "Cuiaba"),
("America/Curacao", "Curacao"),
("America/Danmarkshavn", "Danmarkshavn"),
("America/Dawson", "Dawson"),
("America/Dawson_Creek", "Dawson_Creek"),
("America/Denver", "Denver"),
("America/Detroit", "Detroit"),
("America/Dominica", "Dominica"),
("America/Edmonton", "Edmonton"),
("America/Eirunepe", "Eirunepe"),
("America/El_Salvador", "El_Salvador"),
("America/Ensenada", "Ensenada"),
("America/Fort_Nelson", "Fort_Nelson"),
("America/Fort_Wayne", "Fort_Wayne"),
("America/Fortaleza", "Fortaleza"),
("America/Glace_Bay", "Glace_Bay"),
("America/Godthab", "Godthab"),
("America/Goose_Bay", "Goose_Bay"),
("America/Grand_Turk", "Grand_Turk"),
("America/Grenada", "Grenada"),
("America/Guadeloupe", "Guadeloupe"),
("America/Guatemala", "Guatemala"),
("America/Guayaquil", "Guayaquil"),
("America/Guyana", "Guyana"),
("America/Halifax", "Halifax"),
("America/Havana", "Havana"),
("America/Hermosillo", "Hermosillo"),
("America/Indiana/Indianapolis", "Indiana/Indianapolis"),
("America/Indiana/Knox", "Indiana/Knox"),
("America/Indiana/Marengo", "Indiana/Marengo"),
("America/Indiana/Petersburg", "Indiana/Petersburg"),
("America/Indiana/Tell_City", "Indiana/Tell_City"),
("America/Indiana/Vevay", "Indiana/Vevay"),
("America/Indiana/Vincennes", "Indiana/Vincennes"),
("America/Indiana/Winamac", "Indiana/Winamac"),
("America/Indianapolis", "Indianapolis"),
("America/Inuvik", "Inuvik"),
("America/Iqaluit", "Iqaluit"),
("America/Jamaica", "Jamaica"),
("America/Jujuy", "Jujuy"),
("America/Juneau", "Juneau"),
("America/Kentucky/Louisville", "Kentucky/Louisville"),
("America/Kentucky/Monticello", "Kentucky/Monticello"),
("America/Knox_IN", "Knox_IN"),
("America/Kralendijk", "Kralendijk"),
("America/La_Paz", "La_Paz"),
("America/Lima", "Lima"),
("America/Los_Angeles", "Los_Angeles"),
("America/Louisville", "Louisville"),
("America/Lower_Princes", "Lower_Princes"),
("America/Maceio", "Maceio"),
("America/Managua", "Managua"),
("America/Manaus", "Manaus"),
("America/Marigot", "Marigot"),
("America/Martinique", "Martinique"),
("America/Matamoros", "Matamoros"),
("America/Mazatlan", "Mazatlan"),
("America/Mendoza", "Mendoza"),
("America/Menominee", "Menominee"),
("America/Merida", "Merida"),
("America/Metlakatla", "Metlakatla"),
("America/Mexico_City", "Mexico_City"),
("America/Miquelon", "Miquelon"),
("America/Moncton", "Moncton"),
("America/Monterrey", "Monterrey"),
("America/Montevideo", "Montevideo"),
("America/Montreal", "Montreal"),
("America/Montserrat", "Montserrat"),
("America/Nassau", "Nassau"),
("America/New_York", "New_York"),
("America/Nipigon", "Nipigon"),
("America/Nome", "Nome"),
("America/Noronha", "Noronha"),
("America/North_Dakota/Beulah", "North_Dakota/Beulah"),
("America/North_Dakota/Center", "North_Dakota/Center"),
(
"America/North_Dakota/New_Salem",
"North_Dakota/New_Salem",
),
("America/Nuuk", "Nuuk"),
("America/Ojinaga", "Ojinaga"),
("America/Panama", "Panama"),
("America/Pangnirtung", "Pangnirtung"),
("America/Paramaribo", "Paramaribo"),
("America/Phoenix", "Phoenix"),
("America/Port-au-Prince", "Port-au-Prince"),
("America/Port_of_Spain", "Port_of_Spain"),
("America/Porto_Acre", "Porto_Acre"),
("America/Porto_Velho", "Porto_Velho"),
("America/Puerto_Rico", "Puerto_Rico"),
("America/Punta_Arenas", "Punta_Arenas"),
("America/Rainy_River", "Rainy_River"),
("America/Rankin_Inlet", "Rankin_Inlet"),
("America/Recife", "Recife"),
("America/Regina", "Regina"),
("America/Resolute", "Resolute"),
("America/Rio_Branco", "Rio_Branco"),
("America/Rosario", "Rosario"),
("America/Santa_Isabel", "Santa_Isabel"),
("America/Santarem", "Santarem"),
("America/Santiago", "Santiago"),
("America/Santo_Domingo", "Santo_Domingo"),
("America/Sao_Paulo", "Sao_Paulo"),
("America/Scoresbysund", "Scoresbysund"),
("America/Shiprock", "Shiprock"),
("America/Sitka", "Sitka"),
("America/St_Barthelemy", "St_Barthelemy"),
("America/St_Johns", "St_Johns"),
("America/St_Kitts", "St_Kitts"),
("America/St_Lucia", "St_Lucia"),
("America/St_Thomas", "St_Thomas"),
("America/St_Vincent", "St_Vincent"),
("America/Swift_Current", "Swift_Current"),
("America/Tegucigalpa", "Tegucigalpa"),
("America/Thule", "Thule"),
("America/Thunder_Bay", "Thunder_Bay"),
("America/Tijuana", "Tijuana"),
("America/Toronto", "Toronto"),
("America/Tortola", "Tortola"),
("America/Vancouver", "Vancouver"),
("America/Virgin", "Virgin"),
("America/Whitehorse", "Whitehorse"),
("America/Winnipeg", "Winnipeg"),
("America/Yakutat", "Yakutat"),
("America/Yellowknife", "Yellowknife"),
],
),
(
"Antarctica",
[
("Antarctica/Casey", "Casey"),
("Antarctica/Davis", "Davis"),
("Antarctica/DumontDUrville", "DumontDUrville"),
("Antarctica/Macquarie", "Macquarie"),
("Antarctica/Mawson", "Mawson"),
("Antarctica/McMurdo", "McMurdo"),
("Antarctica/Palmer", "Palmer"),
("Antarctica/Rothera", "Rothera"),
("Antarctica/South_Pole", "South_Pole"),
("Antarctica/Syowa", "Syowa"),
("Antarctica/Troll", "Troll"),
("Antarctica/Vostok", "Vostok"),
],
),
("Arctic", [("Arctic/Longyearbyen", "Longyearbyen")]),
(
"Asia",
[
("Asia/Aden", "Aden"),
("Asia/Almaty", "Almaty"),
("Asia/Amman", "Amman"),
("Asia/Anadyr", "Anadyr"),
("Asia/Aqtau", "Aqtau"),
("Asia/Aqtobe", "Aqtobe"),
("Asia/Ashgabat", "Ashgabat"),
("Asia/Ashkhabad", "Ashkhabad"),
("Asia/Atyrau", "Atyrau"),
("Asia/Baghdad", "Baghdad"),
("Asia/Bahrain", "Bahrain"),
("Asia/Baku", "Baku"),
("Asia/Bangkok", "Bangkok"),
("Asia/Barnaul", "Barnaul"),
("Asia/Beirut", "Beirut"),
("Asia/Bishkek", "Bishkek"),
("Asia/Brunei", "Brunei"),
("Asia/Calcutta", "Calcutta"),
("Asia/Chita", "Chita"),
("Asia/Choibalsan", "Choibalsan"),
("Asia/Chongqing", "Chongqing"),
("Asia/Chungking", "Chungking"),
("Asia/Colombo", "Colombo"),
("Asia/Dacca", "Dacca"),
("Asia/Damascus", "Damascus"),
("Asia/Dhaka", "Dhaka"),
("Asia/Dili", "Dili"),
("Asia/Dubai", "Dubai"),
("Asia/Dushanbe", "Dushanbe"),
("Asia/Famagusta", "Famagusta"),
("Asia/Gaza", "Gaza"),
("Asia/Harbin", "Harbin"),
("Asia/Hebron", "Hebron"),
("Asia/Ho_Chi_Minh", "Ho_Chi_Minh"),
("Asia/Hong_Kong", "Hong_Kong"),
("Asia/Hovd", "Hovd"),
("Asia/Irkutsk", "Irkutsk"),
("Asia/Istanbul", "Istanbul"),
("Asia/Jakarta", "Jakarta"),
("Asia/Jayapura", "Jayapura"),
("Asia/Jerusalem", "Jerusalem"),
("Asia/Kabul", "Kabul"),
("Asia/Kamchatka", "Kamchatka"),
("Asia/Karachi", "Karachi"),
("Asia/Kashgar", "Kashgar"),
("Asia/Kathmandu", "Kathmandu"),
("Asia/Katmandu", "Katmandu"),
("Asia/Khandyga", "Khandyga"),
("Asia/Kolkata", "Kolkata"),
("Asia/Krasnoyarsk", "Krasnoyarsk"),
("Asia/Kuala_Lumpur", "Kuala_Lumpur"),
("Asia/Kuching", "Kuching"),
("Asia/Kuwait", "Kuwait"),
("Asia/Macao", "Macao"),
("Asia/Macau", "Macau"),
("Asia/Magadan", "Magadan"),
("Asia/Makassar", "Makassar"),
("Asia/Manila", "Manila"),
("Asia/Muscat", "Muscat"),
("Asia/Nicosia", "Nicosia"),
("Asia/Novokuznetsk", "Novokuznetsk"),
("Asia/Novosibirsk", "Novosibirsk"),
("Asia/Omsk", "Omsk"),
("Asia/Oral", "Oral"),
("Asia/Phnom_Penh", "Phnom_Penh"),
("Asia/Pontianak", "Pontianak"),
("Asia/Pyongyang", "Pyongyang"),
("Asia/Qatar", "Qatar"),
("Asia/Qostanay", "Qostanay"),
("Asia/Qyzylorda", "Qyzylorda"),
("Asia/Rangoon", "Rangoon"),
("Asia/Riyadh", "Riyadh"),
("Asia/Saigon", "Saigon"),
("Asia/Sakhalin", "Sakhalin"),
("Asia/Samarkand", "Samarkand"),
("Asia/Seoul", "Seoul"),
("Asia/Shanghai", "Shanghai"),
("Asia/Singapore", "Singapore"),
("Asia/Srednekolymsk", "Srednekolymsk"),
("Asia/Taipei", "Taipei"),
("Asia/Tashkent", "Tashkent"),
("Asia/Tbilisi", "Tbilisi"),
("Asia/Tehran", "Tehran"),
("Asia/Tel_Aviv", "Tel_Aviv"),
("Asia/Thimbu", "Thimbu"),
("Asia/Thimphu", "Thimphu"),
("Asia/Tokyo", "Tokyo"),
("Asia/Tomsk", "Tomsk"),
("Asia/Ujung_Pandang", "Ujung_Pandang"),
("Asia/Ulaanbaatar", "Ulaanbaatar"),
("Asia/Ulan_Bator", "Ulan_Bator"),
("Asia/Urumqi", "Urumqi"),
("Asia/Ust-Nera", "Ust-Nera"),
("Asia/Vientiane", "Vientiane"),
("Asia/Vladivostok", "Vladivostok"),
("Asia/Yakutsk", "Yakutsk"),
("Asia/Yangon", "Yangon"),
("Asia/Yekaterinburg", "Yekaterinburg"),
("Asia/Yerevan", "Yerevan"),
],
),
(
"Atlantic",
[
("Atlantic/Azores", "Azores"),
("Atlantic/Bermuda", "Bermuda"),
("Atlantic/Canary", "Canary"),
("Atlantic/Cape_Verde", "Cape_Verde"),
("Atlantic/Faeroe", "Faeroe"),
("Atlantic/Faroe", "Faroe"),
("Atlantic/Jan_Mayen", "Jan_Mayen"),
("Atlantic/Madeira", "Madeira"),
("Atlantic/Reykjavik", "Reykjavik"),
("Atlantic/South_Georgia", "South_Georgia"),
("Atlantic/St_Helena", "St_Helena"),
("Atlantic/Stanley", "Stanley"),
],
),
(
"Australia",
[
("Australia/ACT", "ACT"),
("Australia/Adelaide", "Adelaide"),
("Australia/Brisbane", "Brisbane"),
("Australia/Broken_Hill", "Broken_Hill"),
("Australia/Canberra", "Canberra"),
("Australia/Currie", "Currie"),
("Australia/Darwin", "Darwin"),
("Australia/Eucla", "Eucla"),
("Australia/Hobart", "Hobart"),
("Australia/LHI", "LHI"),
("Australia/Lindeman", "Lindeman"),
("Australia/Lord_Howe", "Lord_Howe"),
("Australia/Melbourne", "Melbourne"),
("Australia/NSW", "NSW"),
("Australia/North", "North"),
("Australia/Perth", "Perth"),
("Australia/Queensland", "Queensland"),
("Australia/South", "South"),
("Australia/Sydney", "Sydney"),
("Australia/Tasmania", "Tasmania"),
("Australia/Victoria", "Victoria"),
("Australia/West", "West"),
("Australia/Yancowinna", "Yancowinna"),
],
),
(
"Brazil",
[
("Brazil/Acre", "Acre"),
("Brazil/DeNoronha", "DeNoronha"),
("Brazil/East", "East"),
("Brazil/West", "West"),
],
),
(
"Canada",
[
("Canada/Atlantic", "Atlantic"),
("Canada/Central", "Central"),
("Canada/Eastern", "Eastern"),
("Canada/Mountain", "Mountain"),
("Canada/Newfoundland", "Newfoundland"),
("Canada/Pacific", "Pacific"),
("Canada/Saskatchewan", "Saskatchewan"),
("Canada/Yukon", "Yukon"),
],
),
(
"Chile",
[
("Chile/Continental", "Continental"),
("Chile/EasterIsland", "EasterIsland"),
],
),
(
"Etc",
[
("Etc/Greenwich", "Greenwich"),
("Etc/UCT", "UCT"),
("Etc/UTC", "UTC"),
("Etc/Universal", "Universal"),
("Etc/Zulu", "Zulu"),
],
),
(
"Europe",
[
("Europe/Amsterdam", "Amsterdam"),
("Europe/Andorra", "Andorra"),
("Europe/Astrakhan", "Astrakhan"),
("Europe/Athens", "Athens"),
("Europe/Belfast", "Belfast"),
("Europe/Belgrade", "Belgrade"),
("Europe/Berlin", "Berlin"),
("Europe/Bratislava", "Bratislava"),
("Europe/Brussels", "Brussels"),
("Europe/Bucharest", "Bucharest"),
("Europe/Budapest", "Budapest"),
("Europe/Busingen", "Busingen"),
("Europe/Chisinau", "Chisinau"),
("Europe/Copenhagen", "Copenhagen"),
("Europe/Dublin", "Dublin"),
("Europe/Gibraltar", "Gibraltar"),
("Europe/Guernsey", "Guernsey"),
("Europe/Helsinki", "Helsinki"),
("Europe/Isle_of_Man", "Isle_of_Man"),
("Europe/Istanbul", "Istanbul"),
("Europe/Jersey", "Jersey"),
("Europe/Kaliningrad", "Kaliningrad"),
("Europe/Kiev", "Kiev"),
("Europe/Kirov", "Kirov"),
("Europe/Kyiv", "Kyiv"),
("Europe/Lisbon", "Lisbon"),
("Europe/Ljubljana", "Ljubljana"),
("Europe/London", "London"),
("Europe/Luxembourg", "Luxembourg"),
("Europe/Madrid", "Madrid"),
("Europe/Malta", "Malta"),
("Europe/Mariehamn", "Mariehamn"),
("Europe/Minsk", "Minsk"),
("Europe/Monaco", "Monaco"),
("Europe/Moscow", "Moscow"),
("Europe/Nicosia", "Nicosia"),
("Europe/Oslo", "Oslo"),
("Europe/Paris", "Paris"),
("Europe/Podgorica", "Podgorica"),
("Europe/Prague", "Prague"),
("Europe/Riga", "Riga"),
("Europe/Rome", "Rome"),
("Europe/Samara", "Samara"),
("Europe/San_Marino", "San_Marino"),
("Europe/Sarajevo", "Sarajevo"),
("Europe/Saratov", "Saratov"),
("Europe/Simferopol", "Simferopol"),
("Europe/Skopje", "Skopje"),
("Europe/Sofia", "Sofia"),
("Europe/Stockholm", "Stockholm"),
("Europe/Tallinn", "Tallinn"),
("Europe/Tirane", "Tirane"),
("Europe/Tiraspol", "Tiraspol"),
("Europe/Ulyanovsk", "Ulyanovsk"),
("Europe/Uzhgorod", "Uzhgorod"),
("Europe/Vaduz", "Vaduz"),
("Europe/Vatican", "Vatican"),
("Europe/Vienna", "Vienna"),
("Europe/Vilnius", "Vilnius"),
("Europe/Volgograd", "Volgograd"),
("Europe/Warsaw", "Warsaw"),
("Europe/Zagreb", "Zagreb"),
("Europe/Zaporozhye", "Zaporozhye"),
("Europe/Zurich", "Zurich"),
],
),
(
"Indian",
[
("Indian/Antananarivo", "Antananarivo"),
("Indian/Chagos", "Chagos"),
("Indian/Christmas", "Christmas"),
("Indian/Cocos", "Cocos"),
("Indian/Comoro", "Comoro"),
("Indian/Kerguelen", "Kerguelen"),
("Indian/Mahe", "Mahe"),
("Indian/Maldives", "Maldives"),
("Indian/Mauritius", "Mauritius"),
("Indian/Mayotte", "Mayotte"),
("Indian/Reunion", "Reunion"),
],
),
(
"Mexico",
[
("Mexico/BajaNorte", "BajaNorte"),
("Mexico/BajaSur", "BajaSur"),
("Mexico/General", "General"),
],
),
(
"Other",
[
("CET", "CET"),
("CST6CDT", "CST6CDT"),
("Cuba", "Cuba"),
("EET", "EET"),
("EST", "EST"),
("EST5EDT", "EST5EDT"),
("Egypt", "Egypt"),
("Eire", "Eire"),
("GB", "GB"),
("GB-Eire", "GB-Eire"),
("Greenwich", "Greenwich"),
("HST", "HST"),
("Hongkong", "Hongkong"),
("Iceland", "Iceland"),
("Iran", "Iran"),
("Israel", "Israel"),
("Jamaica", "Jamaica"),
("Japan", "Japan"),
("Kwajalein", "Kwajalein"),
("Libya", "Libya"),
("MET", "MET"),
("MST", "MST"),
("MST7MDT", "MST7MDT"),
("NZ", "NZ"),
("NZ-CHAT", "NZ-CHAT"),
("Navajo", "Navajo"),
("PRC", "PRC"),
("PST8PDT", "PST8PDT"),
("Poland", "Poland"),
("Portugal", "Portugal"),
("ROC", "ROC"),
("ROK", "ROK"),
("Singapore", "Singapore"),
("Turkey", "Turkey"),
("UCT", "UCT"),
("UTC", "UTC"),
("Universal", "Universal"),
("W-SU", "W-SU"),
("WET", "WET"),
("Zulu", "Zulu"),
],
),
(
"Pacific",
[
("Pacific/Apia", "Apia"),
("Pacific/Auckland", "Auckland"),
("Pacific/Bougainville", "Bougainville"),
("Pacific/Chatham", "Chatham"),
("Pacific/Chuuk", "Chuuk"),
("Pacific/Easter", "Easter"),
("Pacific/Efate", "Efate"),
("Pacific/Enderbury", "Enderbury"),
("Pacific/Fakaofo", "Fakaofo"),
("Pacific/Fiji", "Fiji"),
("Pacific/Funafuti", "Funafuti"),
("Pacific/Galapagos", "Galapagos"),
("Pacific/Gambier", "Gambier"),
("Pacific/Guadalcanal", "Guadalcanal"),
("Pacific/Guam", "Guam"),
("Pacific/Honolulu", "Honolulu"),
("Pacific/Johnston", "Johnston"),
("Pacific/Kanton", "Kanton"),
("Pacific/Kiritimati", "Kiritimati"),
("Pacific/Kosrae", "Kosrae"),
("Pacific/Kwajalein", "Kwajalein"),
("Pacific/Majuro", "Majuro"),
("Pacific/Marquesas", "Marquesas"),
("Pacific/Midway", "Midway"),
("Pacific/Nauru", "Nauru"),
("Pacific/Niue", "Niue"),
("Pacific/Norfolk", "Norfolk"),
("Pacific/Noumea", "Noumea"),
("Pacific/Pago_Pago", "Pago_Pago"),
("Pacific/Palau", "Palau"),
("Pacific/Pitcairn", "Pitcairn"),
("Pacific/Pohnpei", "Pohnpei"),
("Pacific/Ponape", "Ponape"),
("Pacific/Port_Moresby", "Port_Moresby"),
("Pacific/Rarotonga", "Rarotonga"),
("Pacific/Saipan", "Saipan"),
("Pacific/Samoa", "Samoa"),
("Pacific/Tahiti", "Tahiti"),
("Pacific/Tarawa", "Tarawa"),
("Pacific/Tongatapu", "Tongatapu"),
("Pacific/Truk", "Truk"),
("Pacific/Wake", "Wake"),
("Pacific/Wallis", "Wallis"),
("Pacific/Yap", "Yap"),
],
),
(
"US",
[
("US/Alaska", "Alaska"),
("US/Aleutian", "Aleutian"),
("US/Arizona", "Arizona"),
("US/Central", "Central"),
("US/East-Indiana", "East-Indiana"),
("US/Eastern", "Eastern"),
("US/Hawaii", "Hawaii"),
("US/Indiana-Starke", "Indiana-Starke"),
("US/Michigan", "Michigan"),
("US/Mountain", "Mountain"),
("US/Pacific", "Pacific"),
("US/Samoa", "Samoa"),
],
),
],
default="Asia/Ho_Chi_Minh",
max_length=50,
verbose_name="location",
),
),
migrations.CreateModel(
name="OrganizationProfile",
fields=[
(
"last_visit",
models.AutoField(
primary_key=True, serialize=False, verbose_name="last visit"
),
),
(
"organization",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="last_vist",
to="judge.Organization",
verbose_name="organization",
),
),
(
"users",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="last_visit",
to="judge.Profile",
verbose_name="user",
),
),
],
),
]

View file

@ -39,7 +39,13 @@ from judge.models.problem_data import (
problem_data_storage,
problem_directory_file,
)
from judge.models.profile import Organization, OrganizationRequest, Profile, Friend
from judge.models.profile import (
Organization,
OrganizationRequest,
Profile,
Friend,
OrganizationProfile,
)
from judge.models.runtime import Judge, Language, RuntimeVersion
from judge.models.submission import (
SUBMISSION_RESULT,

View file

@ -422,3 +422,41 @@ class Friend(models.Model):
def __str__(self):
return str(self.current_user)
class OrganizationProfile(models.Model):
users = models.ForeignKey(
Profile,
verbose_name=_("user"),
related_name="last_visit",
on_delete=models.CASCADE,
db_index=True,
)
organization = models.ForeignKey(
Organization,
verbose_name=_("organization"),
related_name="last_vist",
on_delete=models.CASCADE,
)
last_visit = models.AutoField(
verbose_name=_("last visit"),
primary_key=True,
)
@classmethod
def remove_organization(self, users, organization):
organizationprofile = self.objects.filter(
users=users, organization=organization
)
if organizationprofile.exists():
organizationprofile.delete()
@classmethod
def add_organization(self, users, organization):
self.remove_organization(users, organization)
new_organization = OrganizationProfile(users=users, organization=organization)
new_organization.save()
@classmethod
def get_most_recent_organizations(self, users):
return self.objects.filter(users=users).order_by("-last_visit")[:5]

View file

@ -18,6 +18,7 @@ from judge.models import (
Submission,
Ticket,
)
from judge.models.profile import Organization, OrganizationProfile
from judge.utils.cachedict import CacheDict
from judge.utils.diggpaginator import DiggPaginator
from judge.utils.problems import user_completed_ids
@ -73,10 +74,14 @@ class FeedView(ListView):
.filter(is_visible=True)
.order_by("start_time")
)
context["current_contests"] = visible_contests.filter(
start_time__lte=now, end_time__gt=now
)
context["future_contests"] = visible_contests.filter(start_time__gt=now)
context[
"recent_organizations"
] = OrganizationProfile.get_most_recent_organizations(self.request.profile)
context["top_rated"] = Profile.objects.filter(is_unlisted=False).order_by(
"-rating"
)[:10]

View file

@ -57,6 +57,7 @@ from judge.models import (
Contest,
Notification,
ContestProblem,
OrganizationProfile,
)
from judge import event_poster as event
from judge.utils.ranker import ranker
@ -150,6 +151,11 @@ class OrganizationMixin(OrganizationBase):
return HttpResponsePermanentRedirect(
request.get_full_path().replace(kwargs["slug"], self.organization.slug)
)
if self.request.user.is_authenticated:
OrganizationProfile.add_organization(
self.request.profile, self.organization
)
return super(OrganizationMixin, self).dispatch(request, *args, **kwargs)

View file

@ -438,7 +438,7 @@ def edit_profile(request):
form.fields["test_site"].initial = request.user.has_perm("judge.test_site")
tzmap = settings.TIMEZONE_MAP
print(settings.REGISTER_NAME_URL)
return render(
request,
"user/edit-profile.html",

View file

@ -21,6 +21,7 @@ msgstr ""
#: chat_box/models.py:31 chat_box/models.py:52 chat_box/models.py:63
#: judge/admin/interface.py:150 judge/models/contest.py:622
#: judge/models/contest.py:815 judge/models/profile.py:354
#: judge/models/profile.py:430
msgid "user"
msgstr "người dùng"
@ -474,7 +475,7 @@ msgstr "Đăng ký để nhận thông báo về các kỳ thi"
msgid "Enable experimental features"
msgstr "Sử dụng các tính năng thử nghiệm"
#: judge/forms.py:108 judge/views/organization.py:513
#: judge/forms.py:108 judge/views/organization.py:514
#: judge/views/register.py:68
#, python-brace-format
msgid "You may not be part of more than {count} public groups."
@ -1765,7 +1766,7 @@ msgid ""
msgstr "Ảnh này sẽ thay thế logo mặc định khi ở trong tổ chức."
#: judge/models/profile.py:125 judge/models/profile.py:154
#: judge/models/profile.py:360
#: judge/models/profile.py:360 judge/models/profile.py:437
msgid "organization"
msgstr ""
@ -1899,6 +1900,12 @@ msgstr "đơn đăng ký tham gia"
msgid "organization join requests"
msgstr "đơn đăng ký tham gia"
#: judge/models/profile.py:442
#, fuzzy
#| msgid "last seen"
msgid "last visit"
msgstr "xem lần cuối"
#: judge/models/runtime.py:21
msgid "short identifier"
msgstr "tên ngắn"
@ -2473,8 +2480,8 @@ msgstr "Bạn phải giải ít nhất 1 bài trước khi được vote."
msgid "You already voted."
msgstr "Bạn đã vote."
#: judge/views/comment.py:155 judge/views/organization.py:813
#: judge/views/organization.py:959 judge/views/organization.py:1124
#: judge/views/comment.py:155 judge/views/organization.py:814
#: judge/views/organization.py:960 judge/views/organization.py:1125
msgid "Edited from site"
msgstr "Chỉnh sửa từ web"
@ -2652,91 +2659,91 @@ msgstr "Runtimes"
msgid "Notifications (%d unseen)"
msgstr "Thông báo (%d chưa xem)"
#: judge/views/organization.py:140 judge/views/organization.py:146
#: judge/views/organization.py:142 judge/views/organization.py:148
msgid "No such organization"
msgstr "Không có tổ chức như vậy"
#: judge/views/organization.py:141
#: judge/views/organization.py:143
#, python-format
msgid "Could not find an organization with the key \"%s\"."
msgstr "Không tìm thấy tổ chức với mã \"%s\"."
#: judge/views/organization.py:147
#: judge/views/organization.py:149
msgid "Could not find such organization."
msgstr ""
#: judge/views/organization.py:165
#: judge/views/organization.py:167
msgid "Can't edit organization"
msgstr "Không thể chỉnh sửa tổ chức"
#: judge/views/organization.py:166
#: judge/views/organization.py:168
msgid "You are not allowed to edit this organization."
msgstr "Bạn không được phép chỉnh sửa tổ chức này."
#: judge/views/organization.py:178 judge/views/organization.py:323
#: judge/views/organization.py:180 judge/views/organization.py:324
#, fuzzy
#| msgid "Can't edit organization"
msgid "Can't access organization"
msgstr "Không thể chỉnh sửa tổ chức"
#: judge/views/organization.py:179 judge/views/organization.py:324
#: judge/views/organization.py:181 judge/views/organization.py:325
msgid "You are not allowed to access this organization."
msgstr "Bạn không được phép chỉnh sửa tổ chức này."
#: judge/views/organization.py:237 judge/views/register.py:49
#: judge/views/organization.py:239 judge/views/register.py:49
#: judge/views/stats.py:184 templates/contest/list.html:87
#: templates/problem/list-base.html:104 templates/stats/site.html:33
#: templates/user/user-left-sidebar.html:4 templates/user/user-list-tabs.html:6
msgid "Groups"
msgstr "Nhóm"
#: judge/views/organization.py:330
#: judge/views/organization.py:331
#, python-format
msgid "%s Members"
msgstr "%s Thành viên"
#: judge/views/organization.py:469
#: judge/views/organization.py:470
#, python-brace-format
msgid "All submissions in <a href=\"{1}\">{0}</a>"
msgstr "Bài nộp trong <a href=\"{1}\">{0}</a>"
#: judge/views/organization.py:499 judge/views/organization.py:505
#: judge/views/organization.py:512
#: judge/views/organization.py:500 judge/views/organization.py:506
#: judge/views/organization.py:513
msgid "Joining group"
msgstr "Tham gia nhóm"
#: judge/views/organization.py:500
#: judge/views/organization.py:501
msgid "You are already in the group."
msgstr "Bạn đã ở trong nhóm."
#: judge/views/organization.py:505
#: judge/views/organization.py:506
msgid "This group is not open."
msgstr "Nhóm này là nhóm kín."
#: judge/views/organization.py:528
#: judge/views/organization.py:529
msgid "Leaving group"
msgstr "Rời nhóm"
#: judge/views/organization.py:529
#: judge/views/organization.py:530
#, python-format
msgid "You are not in \"%s\"."
msgstr "Bạn không ở trong \"%s\"."
#: judge/views/organization.py:554
#: judge/views/organization.py:555
#, python-format
msgid "Request to join %s"
msgstr "Đăng ký tham gia %s"
#: judge/views/organization.py:585
#: judge/views/organization.py:586
msgid "Join request detail"
msgstr "Chi tiết đơn đăng ký"
#: judge/views/organization.py:633
#: judge/views/organization.py:634
#, python-format
msgid "Managing join requests for %s"
msgstr "Quản lý đơn đăng ký cho %s"
#: judge/views/organization.py:673
#: judge/views/organization.py:674
#, python-format
msgid ""
"Your organization can only receive %d more members. You cannot approve %d "
@ -2745,96 +2752,96 @@ msgstr ""
"Tổ chức chỉ có thể chứa %d thành viên. Bạn không thể chấp thuận nhiều hơn %d "
"người."
#: judge/views/organization.py:691
#: judge/views/organization.py:692
#, python-format
msgid "Approved %d user."
msgid_plural "Approved %d users."
msgstr[0] "Đã chấp thuận %d người."
#: judge/views/organization.py:694
#: judge/views/organization.py:695
#, python-format
msgid "Rejected %d user."
msgid_plural "Rejected %d users."
msgstr[0] "Đã từ chối %d người."
#: judge/views/organization.py:734
#: judge/views/organization.py:735
#, python-format
msgid "Add member for %s"
msgstr "Thêm thành viên cho %s"
#: judge/views/organization.py:746
#: judge/views/organization.py:747
#, fuzzy
#| msgid "Edited from site"
msgid "Added members from site"
msgstr "Chỉnh sửa từ web"
#: judge/views/organization.py:766 judge/views/organization.py:774
#: judge/views/organization.py:767 judge/views/organization.py:775
msgid "Can't kick user"
msgstr "Không thể đuổi"
#: judge/views/organization.py:767
#: judge/views/organization.py:768
msgid "The user you are trying to kick does not exist!"
msgstr ""
#: judge/views/organization.py:775
#: judge/views/organization.py:776
#, python-format
msgid "The user you are trying to kick is not in organization: %s."
msgstr ""
#: judge/views/organization.py:796 judge/views/organization.py:948
#: judge/views/organization.py:797 judge/views/organization.py:949
#, fuzzy, python-format
#| msgid "Editing %s"
msgid "Edit %s"
msgstr "Đang chỉnh sửa %s"
#: judge/views/organization.py:824 templates/organization/list.html:59
#: judge/views/organization.py:825 templates/organization/list.html:59
msgid "Create group"
msgstr "Tạo nhóm"
#: judge/views/organization.py:839
#: judge/views/organization.py:840
msgid "Exceeded limit"
msgstr ""
#: judge/views/organization.py:840
#: judge/views/organization.py:841
#, python-format
msgid "You created too many groups. You can only create at most %d groups"
msgstr ""
#: judge/views/organization.py:845 judge/views/organization.py:870
#: judge/views/organization.py:1014
#: judge/views/organization.py:846 judge/views/organization.py:871
#: judge/views/organization.py:1015
msgid "Added from site"
msgstr "Thêm từ web"
#: judge/views/organization.py:861
#: judge/views/organization.py:862
#: templates/organization/org-right-sidebar.html:55
msgid "Add contest"
msgstr "Thêm kỳ thi"
#: judge/views/organization.py:904 judge/views/organization.py:1066
#: judge/views/organization.py:905 judge/views/organization.py:1067
msgid "Permission denied"
msgstr "Truy cập bị từ chối"
#: judge/views/organization.py:905
#: judge/views/organization.py:906
#, fuzzy
#| msgid "You are not allowed to edit this organization."
msgid "You are not allowed to edit this contest"
msgstr "Bạn không được phép chỉnh sửa tổ chức này."
#: judge/views/organization.py:1003
#: judge/views/organization.py:1004
#, python-format
msgid "Add blog for %s"
msgstr "Thêm bài đăng cho %s"
#: judge/views/organization.py:1067
#: judge/views/organization.py:1068
msgid "Not allowed to edit this blog"
msgstr "Bạn không được phép chỉnh sửa bài đăng này."
#: judge/views/organization.py:1099
#: judge/views/organization.py:1100
#, python-format
msgid "Edit blog %s"
msgstr "Chỉnh sửa %s"
#: judge/views/organization.py:1150
#: judge/views/organization.py:1151
#, python-format
msgid "Pending blogs in %s"
msgstr "Bài đang đợi duyệt trong %s"
@ -3101,8 +3108,8 @@ msgstr "Phải qua một kỳ thi"
#: judge/views/submission.py:781
#, python-brace-format
msgid ""
"<a href=\"{1}\">{0}</a>'s submissions for <a href=\"{3}\">{2}</a> in <a "
"href=\"{5}\">{4}</a>"
"<a href=\"{1}\">{0}</a>'s submissions for <a href=\"{3}\">{2}</a> in <a href="
"\"{5}\">{4}</a>"
msgstr ""
"Các bài nộp của <a href=\"{1}\">{0}</a> cho <a href=\"{3}\">{2}</a> trong <a "
"href=\"{5}\">{4}</a>"
@ -3519,8 +3526,8 @@ msgstr ""
"\n"
" Bình luận bị ẩn vì có quá "
"nhiều phản hồi tiêu cực.\n"
" Nhấn vào <a "
"href=\"javascript:comment_show_content(%(id)s)\">đây</a> để xem.\n"
" Nhấn vào <a href="
"\"javascript:comment_show_content(%(id)s)\">đây</a> để xem.\n"
" "
#: templates/comments/list.html:121
@ -3725,8 +3732,8 @@ msgstr "G:i T, j F, Y"
#: templates/contest/contest.html:59
#, python-format
msgid ""
"<b>%(time_limit)s</b> window between <b>%(start_time)s</b> and "
"<b>%(end_time)s</b>"
"<b>%(time_limit)s</b> window between <b>%(start_time)s</b> and <b>"
"%(end_time)s</b>"
msgstr ""
"Kéo dài <b>%(time_limit)s</b> từ <b>%(start_time)s</b> đến <b>%(end_time)s</"
"b>"
@ -4742,6 +4749,10 @@ msgstr "Không có máy chấm có thể chấm bài này."
msgid "Submit!"
msgstr "Nộp bài!"
#: templates/recent-organization.html:30
msgid "Recent groups"
msgstr "Nhóm gần đây"
#: templates/registration/activate.html:3
#, python-format
msgid "%(key)s is an invalid activation key."

View file

@ -123,6 +123,7 @@
</div>
{% endif %}
{% include 'contests-countdown.html' %}
{% include 'recent-organization.html' %}
{% include 'top-users.html' %}
</div>
{% endblock %}

View file

@ -0,0 +1,41 @@
{% block two_col_media %}
<style>
.organization-row {
display: block;
padding: 0.5em;
border-bottom: 1px gray solid;
border-top: none;
color: black;
font-weight: 500;
display: flex;
align-items: center;
}
.organization-row:hover {
background-color: #f3f3f3;
}
.org-logo {
vertical-align: middle;
height: 2em;
width: 2em;
display: inline-block;
margin-right: 0.5em;
}
.toggle {
cursor: pointer;
}
</style>
{% endblock %}
{% if recent_organizations %}
<div class="blog-sidebox sidebox">
<h3>{{ _('Recent groups') }} <i class="fa fa-users"></i></h3>
<div class="organization-container toggled">
{% for organization in recent_organizations %}
<a href="{{ url('organization_home', organization.organization.pk, organization.organization.slug) }}" class="sidebox-content organization-row" title="{{organization.organization.about}}">
<img class="org-logo" src="{{ organization.organization.logo_override_image or static('icons/icon.png') }}">
<span style="word-break: break-word;">{{ organization.organization }}</span>
</a>
{% endfor %}
</div>
</div>
{% endif %}