fnschool 20250109.80531.837__py3-none-any.whl → 20251011.81638.854__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of fnschool might be problematic. Click here for more details.
- fnschoo1/__init__.py +53 -0
- fnschoo1/canteen/admin.py +3 -0
- fnschoo1/canteen/apps.py +6 -0
- fnschoo1/canteen/forms.py +84 -0
- fnschoo1/canteen/migrations/0001_initial.py +119 -0
- fnschoo1/canteen/migrations/0002_ingredient_is_disabled.py +20 -0
- fnschoo1/canteen/migrations/0003_consumption_is_disabled_alter_ingredient_is_disabled.py +23 -0
- fnschoo1/canteen/migrations/0004_alter_ingredient_name_category_and_more.py +66 -0
- fnschoo1/canteen/migrations/0005_alter_category_created_at_alter_category_name_and_more.py +41 -0
- fnschoo1/canteen/migrations/0006_category_is_disabled_alter_category_user_and_more.py +49 -0
- fnschoo1/canteen/migrations/0007_alter_consumption_amount_used_and_more.py +30 -0
- fnschoo1/canteen/migrations/0008_category_abbreviation_mealtype.py +67 -0
- fnschoo1/canteen/migrations/0009_alter_category_abbreviation_and_more.py +55 -0
- fnschoo1/canteen/migrations/0010_alter_consumption_options_alter_ingredient_options_and_more.py +215 -0
- fnschoo1/canteen/migrations/0011_category_pin_to_consumptions_top.py +23 -0
- fnschoo1/canteen/migrations/0012_alter_ingredient_storage_date.py +18 -0
- fnschoo1/canteen/models.py +179 -0
- fnschoo1/canteen/templates/canteen/category/create.html +17 -0
- fnschoo1/canteen/templates/canteen/category/delete.html +61 -0
- fnschoo1/canteen/templates/canteen/category/list.html +63 -0
- fnschoo1/canteen/templates/canteen/category/update.html +23 -0
- fnschoo1/canteen/templates/canteen/close.html +11 -0
- fnschoo1/canteen/templates/canteen/consumption/_create.html +19 -0
- fnschoo1/canteen/templates/canteen/consumption/create.html +456 -0
- fnschoo1/canteen/templates/canteen/ingredient/close.html +11 -0
- fnschoo1/canteen/templates/canteen/ingredient/create.html +19 -0
- fnschoo1/canteen/templates/canteen/ingredient/create_one.html +17 -0
- fnschoo1/canteen/templates/canteen/ingredient/delete.html +41 -0
- fnschoo1/canteen/templates/canteen/ingredient/list.html +128 -0
- fnschoo1/canteen/templates/canteen/ingredient/update.html +23 -0
- fnschoo1/canteen/templates/canteen/meal_type/create.html +17 -0
- fnschoo1/canteen/templates/canteen/meal_type/delete.html +56 -0
- fnschoo1/canteen/templates/canteen/meal_type/list.html +59 -0
- fnschoo1/canteen/templates/canteen/meal_type/update.html +23 -0
- fnschoo1/canteen/tests.py +3 -0
- fnschoo1/canteen/urls.py +116 -0
- fnschoo1/canteen/views.py +814 -0
- fnschoo1/canteen/workbook/generate.py +2098 -0
- fnschoo1/db.sqlite3 +0 -0
- fnschoo1/fnschool/__init__.py +13 -0
- fnschoo1/fnschool/asgi.py +16 -0
- fnschoo1/fnschool/settings.py +167 -0
- fnschoo1/fnschool/templatetags/fnschool_tags.py +27 -0
- fnschoo1/fnschool/urls.py +30 -0
- fnschoo1/fnschool/views.py +9 -0
- fnschoo1/fnschool/wsgi.py +16 -0
- fnschoo1/locale/en/LC_MESSAGES/django.mo +0 -0
- fnschoo1/locale/zh_Hans/LC_MESSAGES/django.mo +0 -0
- fnschoo1/manage.py +25 -0
- fnschoo1/profiles/admin.py +27 -0
- fnschoo1/profiles/apps.py +12 -0
- fnschoo1/profiles/forms.py +67 -0
- fnschoo1/profiles/migrations/0001_initial.py +192 -0
- fnschoo1/profiles/migrations/0002_alter_profile_bio.py +20 -0
- fnschoo1/profiles/migrations/0003_alter_profile_options_alter_profile_address_and_more.py +67 -0
- fnschoo1/profiles/migrations/0004_profile_gender.py +26 -0
- fnschoo1/profiles/migrations/0005_alter_profile_gender.py +23 -0
- fnschoo1/profiles/models.py +60 -0
- fnschoo1/profiles/signals.py +20 -0
- fnschoo1/profiles/templates/profiles/create.html +16 -0
- fnschoo1/profiles/templates/profiles/detail.html +14 -0
- fnschoo1/profiles/templates/profiles/edit.html +12 -0
- fnschoo1/profiles/templates/profiles/log_in.html +20 -0
- fnschoo1/profiles/templates/profiles/log_out.html +12 -0
- fnschoo1/profiles/tests.py +3 -0
- fnschoo1/profiles/urls.py +15 -0
- fnschoo1/profiles/views.py +63 -0
- fnschoo1/static/css/bootstrap.min.css +11776 -0
- fnschoo1/static/css/fnschool.css +26 -0
- fnschoo1/static/images/favicon.ico +0 -0
- fnschoo1/static/js/bootstrap.bundle.min.js +4223 -0
- fnschoo1/static/js/bootstrap.min.js +2919 -0
- fnschoo1/static/js/fnschool.js +84 -0
- fnschoo1/static/js/jquery.min.js +5413 -0
- fnschoo1/static/js/jquery.slim.min.js +4331 -0
- fnschoo1/static/js/popper.min.js +1306 -0
- fnschoo1/static_collected/admin/css/autocomplete.css +377 -0
- fnschoo1/static_collected/admin/css/base.css +1224 -0
- fnschoo1/static_collected/admin/css/changelists.css +334 -0
- fnschoo1/static_collected/admin/css/dark_mode.css +136 -0
- fnschoo1/static_collected/admin/css/dashboard.css +30 -0
- fnschoo1/static_collected/admin/css/forms.css +546 -0
- fnschoo1/static_collected/admin/css/login.css +62 -0
- fnschoo1/static_collected/admin/css/nav_sidebar.css +145 -0
- fnschoo1/static_collected/admin/css/responsive.css +1043 -0
- fnschoo1/static_collected/admin/css/responsive_rtl.css +84 -0
- fnschoo1/static_collected/admin/css/rtl.css +311 -0
- fnschoo1/static_collected/admin/css/vendor/select2/select2.css +708 -0
- fnschoo1/static_collected/admin/css/vendor/select2/select2.min.css +1 -0
- fnschoo1/static_collected/admin/css/widgets.css +639 -0
- fnschoo1/static_collected/admin/js/SelectBox.js +128 -0
- fnschoo1/static_collected/admin/js/SelectFilter2.js +503 -0
- fnschoo1/static_collected/admin/js/actions.js +232 -0
- fnschoo1/static_collected/admin/js/admin/DateTimeShortcuts.js +496 -0
- fnschoo1/static_collected/admin/js/admin/RelatedObjectLookups.js +276 -0
- fnschoo1/static_collected/admin/js/autocomplete.js +33 -0
- fnschoo1/static_collected/admin/js/calendar.js +251 -0
- fnschoo1/static_collected/admin/js/cancel.js +29 -0
- fnschoo1/static_collected/admin/js/change_form.js +21 -0
- fnschoo1/static_collected/admin/js/collapse.js +43 -0
- fnschoo1/static_collected/admin/js/core.js +174 -0
- fnschoo1/static_collected/admin/js/filters.js +37 -0
- fnschoo1/static_collected/admin/js/inlines.js +439 -0
- fnschoo1/static_collected/admin/js/jquery.init.js +8 -0
- fnschoo1/static_collected/admin/js/nav_sidebar.js +81 -0
- fnschoo1/static_collected/admin/js/popup_response.js +24 -0
- fnschoo1/static_collected/admin/js/prepopulate.js +43 -0
- fnschoo1/static_collected/admin/js/prepopulate_init.js +20 -0
- fnschoo1/static_collected/admin/js/theme.js +57 -0
- fnschoo1/static_collected/admin/js/urlify.js +529 -0
- fnschoo1/static_collected/admin/js/vendor/jquery/jquery.js +10913 -0
- fnschoo1/static_collected/admin/js/vendor/jquery/jquery.min.js +2 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/af.js +43 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/ar.js +36 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/az.js +33 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/bg.js +38 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/bn.js +39 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/bs.js +48 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/ca.js +41 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/cs.js +62 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/da.js +37 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/de.js +41 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/dsb.js +51 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/el.js +43 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/en.js +41 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/es.js +41 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/et.js +38 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/eu.js +45 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/fa.js +42 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/fi.js +42 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/fr.js +43 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/gl.js +40 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/he.js +44 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/hi.js +40 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/hr.js +45 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/hsb.js +51 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/hu.js +44 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/hy.js +40 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/id.js +36 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/is.js +37 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/it.js +43 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/ja.js +40 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/ka.js +42 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/km.js +38 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/ko.js +42 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/lt.js +45 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/lv.js +41 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/mk.js +42 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/ms.js +38 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/nb.js +38 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/ne.js +44 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/nl.js +46 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/pl.js +43 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/ps.js +41 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/pt-BR.js +39 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/pt.js +41 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/ro.js +43 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/ru.js +48 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/sk.js +61 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/sl.js +41 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/sq.js +43 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/sr-Cyrl.js +48 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/sr.js +48 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/sv.js +40 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/th.js +36 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/tk.js +36 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/tr.js +40 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/uk.js +59 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/vi.js +37 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/zh-CN.js +36 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/zh-TW.js +33 -0
- fnschoo1/static_collected/admin/js/vendor/select2/select2.full.js +7115 -0
- fnschoo1/static_collected/admin/js/vendor/select2/select2.full.min.js +2 -0
- fnschoo1/static_collected/admin/js/vendor/xregexp/xregexp.js +4993 -0
- fnschoo1/static_collected/admin/js/vendor/xregexp/xregexp.min.js +160 -0
- fnschoo1/static_collected/css/bootstrap.min.css +11776 -0
- fnschoo1/static_collected/css/fnschool.css +26 -0
- fnschoo1/static_collected/images/favicon.ico +0 -0
- fnschoo1/static_collected/js/bootstrap.bundle.min.js +4223 -0
- fnschoo1/static_collected/js/bootstrap.min.js +2919 -0
- fnschoo1/static_collected/js/fnschool.js +84 -0
- fnschoo1/static_collected/js/jquery.min.js +5413 -0
- fnschoo1/static_collected/js/jquery.slim.min.js +4331 -0
- fnschoo1/static_collected/js/popper.min.js +1306 -0
- fnschoo1/templates/base/_css.html +1 -0
- fnschoo1/templates/base/_js.html +15 -0
- fnschoo1/templates/base/content.html +30 -0
- fnschoo1/templates/base/header_content_footer.html +35 -0
- fnschoo1/templates/close.html +11 -0
- fnschoo1/templates/home.html +51 -0
- fnschoo1/templates/includes/_footer.html +39 -0
- fnschoo1/templates/includes/_header.html +77 -0
- fnschoo1/templates/includes/_navigation.html +0 -0
- fnschoo1/templates/includes/_paginator.html +27 -0
- fnschoo1/templates/registration/logged_out.html +0 -0
- fnschoo1/templates/registration/login.html +0 -0
- fnschool-20251011.81638.854.dist-info/METADATA +179 -0
- fnschool-20251011.81638.854.dist-info/RECORD +209 -0
- {fnschool-20250109.80531.837.dist-info → fnschool-20251011.81638.854.dist-info}/WHEEL +1 -1
- fnschool-20251011.81638.854.dist-info/entry_points.txt +2 -0
- fnschool-20251011.81638.854.dist-info/top_level.txt +1 -0
- fnschool/__init__.py +0 -35
- fnschool/__main__.py +0 -16
- fnschool/app.py +0 -103
- fnschool/canteen/__init__.py +0 -3
- fnschool/canteen/__main__.py +0 -3
- fnschool/canteen/bill.py +0 -253
- fnschool/canteen/canteen.py +0 -1
- fnschool/canteen/canteen.toml +0 -61
- fnschool/canteen/config.py +0 -10
- fnschool/canteen/consuming.py +0 -53
- fnschool/canteen/currency.py +0 -17
- fnschool/canteen/data/bill.i18n.xlsx +0 -0
- fnschool/canteen/data/bill.xlsx +0 -0
- fnschool/canteen/data/consuming.xlsx +0 -0
- fnschool/canteen/data/purchase_list.xlsx +0 -0
- fnschool/canteen/entry.py +0 -40
- fnschool/canteen/food.py +0 -206
- fnschool/canteen/food_classes.py +0 -33
- fnschool/canteen/food_classes.toml +0 -64
- fnschool/canteen/operator.py +0 -91
- fnschool/canteen/path.py +0 -28
- fnschool/canteen/spreadsheet/base.py +0 -213
- fnschool/canteen/spreadsheet/consuming.py +0 -310
- fnschool/canteen/spreadsheet/consumingsum.py +0 -76
- fnschool/canteen/spreadsheet/cover.py +0 -64
- fnschool/canteen/spreadsheet/ctspreadsheet.py +0 -351
- fnschool/canteen/spreadsheet/food.py +0 -680
- fnschool/canteen/spreadsheet/inventory.py +0 -375
- fnschool/canteen/spreadsheet/merging.py +0 -340
- fnschool/canteen/spreadsheet/preconsuming.py +0 -329
- fnschool/canteen/spreadsheet/purchasing.py +0 -885
- fnschool/canteen/spreadsheet/purchasingsum.py +0 -110
- fnschool/canteen/spreadsheet/spreadsheet.py +0 -363
- fnschool/canteen/spreadsheet/translating.py +0 -12
- fnschool/canteen/spreadsheet/unwarehousing.py +0 -178
- fnschool/canteen/spreadsheet/unwarehousingsum.py +0 -11
- fnschool/canteen/spreadsheet/warehousing.py +0 -360
- fnschool/canteen/spreadsheet/workbook.py +0 -17
- fnschool/canteen/test.py +0 -97
- fnschool/config.py +0 -48
- fnschool/entry.py +0 -67
- fnschool/exam/__init__.py +0 -8
- fnschool/exam/data/parental_emails.xlsx +0 -0
- fnschool/exam/data/score.xlsx +0 -0
- fnschool/exam/email.py +0 -349
- fnschool/exam/entry.py +0 -36
- fnschool/exam/language.py +0 -19
- fnschool/exam/path.py +0 -24
- fnschool/exam/score.py +0 -1191
- fnschool/exam/subject.py +0 -20
- fnschool/exam/teacher.py +0 -54
- fnschool/external.py +0 -89
- fnschool/games/__init__.py +0 -1
- fnschool/games/__main__.py +0 -1
- fnschool/games/games.py +0 -1
- fnschool/inoutput.py +0 -97
- fnschool/language.py +0 -40
- fnschool/locales/en_US/LC_MESSAGES/fnschool.mo +0 -0
- fnschool/locales/zh_CN/LC_MESSAGES/fnschool.mo +0 -0
- fnschool/locales/zh_HK/LC_MESSAGES/fnschool.mo +0 -0
- fnschool/locales/zh_SG/LC_MESSAGES/fnschool.mo +0 -0
- fnschool/locales/zh_TW/LC_MESSAGES/fnschool.mo +0 -0
- fnschool/path.py +0 -45
- fnschool/test.py +0 -24
- fnschool/user.py +0 -262
- fnschool-20250109.80531.837.dist-info/METADATA +0 -342
- fnschool-20250109.80531.837.dist-info/RECORD +0 -78
- fnschool-20250109.80531.837.dist-info/entry_points.txt +0 -5
- fnschool-20250109.80531.837.dist-info/top_level.txt +0 -1
- /fnschool/canteen/consume.py → /fnschoo1/canteen/__init__.py +0 -0
- /fnschool/canteen/food_recount.toml → /fnschoo1/canteen/migrations/__init__.py +0 -0
- {fnschool/canteen/spreadsheet → fnschoo1/canteen/workbook}/__init__.py +0 -0
- /fnschool/exam/__main__.py → /fnschoo1/fnschool/templatetags/__init__.py +0 -0
- /fnschool/canteen/food_recounts.toml → /fnschoo1/profiles/__init__.py +0 -0
- /fnschool/canteen/warehouse.py → /fnschoo1/profiles/migrations/__init__.py +0 -0
- /fnschool/canteen/workbook.toml → /fnschoo1/templates/base/_content.html +0 -0
- {fnschool-20250109.80531.837.dist-info → fnschool-20251011.81638.854.dist-info/licenses}/LICENSE +0 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Generated by Django 4.2.24 on 2025-09-25 19:43
|
|
2
|
+
|
|
3
|
+
from django.db import migrations, models
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Migration(migrations.Migration):
|
|
7
|
+
|
|
8
|
+
dependencies = [
|
|
9
|
+
("profiles", "0002_alter_profile_bio"),
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
operations = [
|
|
13
|
+
migrations.AlterModelOptions(
|
|
14
|
+
name="profile",
|
|
15
|
+
options={
|
|
16
|
+
"verbose_name": "用户信息",
|
|
17
|
+
"verbose_name_plural": "用户信息",
|
|
18
|
+
},
|
|
19
|
+
),
|
|
20
|
+
migrations.AlterField(
|
|
21
|
+
model_name="profile",
|
|
22
|
+
name="address",
|
|
23
|
+
field=models.CharField(
|
|
24
|
+
blank=True, max_length=255, null=True, verbose_name="地址"
|
|
25
|
+
),
|
|
26
|
+
),
|
|
27
|
+
migrations.AlterField(
|
|
28
|
+
model_name="profile",
|
|
29
|
+
name="affiliation",
|
|
30
|
+
field=models.CharField(
|
|
31
|
+
blank=True, max_length=255, null=True, verbose_name="机构"
|
|
32
|
+
),
|
|
33
|
+
),
|
|
34
|
+
migrations.AlterField(
|
|
35
|
+
model_name="profile",
|
|
36
|
+
name="avatar",
|
|
37
|
+
field=models.ImageField(
|
|
38
|
+
blank=True, null=True, upload_to="avatars/", verbose_name="头像"
|
|
39
|
+
),
|
|
40
|
+
),
|
|
41
|
+
migrations.AlterField(
|
|
42
|
+
model_name="profile",
|
|
43
|
+
name="bio",
|
|
44
|
+
field=models.TextField(
|
|
45
|
+
blank=True, max_length=512, verbose_name="个人简介"
|
|
46
|
+
),
|
|
47
|
+
),
|
|
48
|
+
migrations.AlterField(
|
|
49
|
+
model_name="profile",
|
|
50
|
+
name="date_of_birth",
|
|
51
|
+
field=models.DateField(blank=True, null=True, verbose_name="生日"),
|
|
52
|
+
),
|
|
53
|
+
migrations.AlterField(
|
|
54
|
+
model_name="profile",
|
|
55
|
+
name="phone",
|
|
56
|
+
field=models.CharField(
|
|
57
|
+
blank=True, max_length=15, null=True, verbose_name="电话号码"
|
|
58
|
+
),
|
|
59
|
+
),
|
|
60
|
+
migrations.AlterField(
|
|
61
|
+
model_name="profile",
|
|
62
|
+
name="superior_department",
|
|
63
|
+
field=models.CharField(
|
|
64
|
+
blank=True, max_length=255, null=True, verbose_name="上级机构"
|
|
65
|
+
),
|
|
66
|
+
),
|
|
67
|
+
]
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Generated by Django 4.2.25 on 2025-10-09 03:55
|
|
2
|
+
|
|
3
|
+
from django.db import migrations, models
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Migration(migrations.Migration):
|
|
7
|
+
|
|
8
|
+
dependencies = [
|
|
9
|
+
(
|
|
10
|
+
"profiles",
|
|
11
|
+
"0003_alter_profile_options_alter_profile_address_and_more",
|
|
12
|
+
),
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
operations = [
|
|
16
|
+
migrations.AddField(
|
|
17
|
+
model_name="profile",
|
|
18
|
+
name="gender",
|
|
19
|
+
field=models.CharField(
|
|
20
|
+
choices=[("M", "Male"), ("F", "Female"), ("U", "--")],
|
|
21
|
+
default="U",
|
|
22
|
+
max_length=1,
|
|
23
|
+
verbose_name="Gender",
|
|
24
|
+
),
|
|
25
|
+
),
|
|
26
|
+
]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Generated by Django 4.2.25 on 2025-10-09 09:30
|
|
2
|
+
|
|
3
|
+
from django.db import migrations, models
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Migration(migrations.Migration):
|
|
7
|
+
|
|
8
|
+
dependencies = [
|
|
9
|
+
("profiles", "0004_profile_gender"),
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
operations = [
|
|
13
|
+
migrations.AlterField(
|
|
14
|
+
model_name="profile",
|
|
15
|
+
name="gender",
|
|
16
|
+
field=models.CharField(
|
|
17
|
+
choices=[("M", "男"), ("F", "女"), ("U", "--")],
|
|
18
|
+
default="U",
|
|
19
|
+
max_length=1,
|
|
20
|
+
verbose_name="性别",
|
|
21
|
+
),
|
|
22
|
+
),
|
|
23
|
+
]
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
from django.contrib.auth.models import AbstractUser, User
|
|
2
|
+
from django.db import models
|
|
3
|
+
from django.db.models.signals import post_save
|
|
4
|
+
from django.dispatch import receiver
|
|
5
|
+
from django.utils.translation import gettext as _
|
|
6
|
+
from fnschool import *
|
|
7
|
+
|
|
8
|
+
# Create your models here.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Gender(models.TextChoices):
|
|
12
|
+
MALE = "M", _("Male")
|
|
13
|
+
FEMALE = "F", _("Female")
|
|
14
|
+
UNKNOWN = "U", "--"
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class Profile(AbstractUser):
|
|
18
|
+
phone = models.CharField(
|
|
19
|
+
max_length=15, blank=True, null=True, verbose_name=_("Phone Number")
|
|
20
|
+
)
|
|
21
|
+
affiliation = models.CharField(
|
|
22
|
+
max_length=255, blank=True, null=True, verbose_name=_("Affiliation")
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
superior_department = models.CharField(
|
|
26
|
+
max_length=255,
|
|
27
|
+
blank=True,
|
|
28
|
+
null=True,
|
|
29
|
+
verbose_name=_("Superior department"),
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
date_of_birth = models.DateField(
|
|
33
|
+
blank=True, null=True, verbose_name=_("Date of Birth")
|
|
34
|
+
)
|
|
35
|
+
gender = models.CharField(
|
|
36
|
+
max_length=1,
|
|
37
|
+
choices=Gender.choices,
|
|
38
|
+
default=Gender.UNKNOWN,
|
|
39
|
+
verbose_name=_("Gender"),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
address = models.CharField(
|
|
43
|
+
max_length=255, blank=True, null=True, verbose_name=_("Address")
|
|
44
|
+
)
|
|
45
|
+
avatar = models.ImageField(
|
|
46
|
+
upload_to="avatars/", blank=True, null=True, verbose_name=_("Avatar")
|
|
47
|
+
)
|
|
48
|
+
bio = models.TextField(
|
|
49
|
+
max_length=512, blank=True, verbose_name=_("Biography")
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
class Meta:
|
|
53
|
+
verbose_name = _("User Profile")
|
|
54
|
+
verbose_name_plural = _("User Profiles")
|
|
55
|
+
|
|
56
|
+
def __str__(self):
|
|
57
|
+
return _("{0}'s Profile").format(self.username)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
# The end.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from django.contrib.auth.models import User
|
|
2
|
+
from django.db.models.signals import post_save
|
|
3
|
+
from django.dispatch import receiver
|
|
4
|
+
|
|
5
|
+
from .models import Profile
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@receiver(post_save, sender=User)
|
|
9
|
+
def create_user_profile(sender, instance, created, **kwargs):
|
|
10
|
+
if created:
|
|
11
|
+
Profile.objects.create(user=instance)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@receiver(post_save, sender=User)
|
|
15
|
+
def save_user_profile(sender, instance, **kwargs):
|
|
16
|
+
if hasattr(instance, "profile"):
|
|
17
|
+
instance.profile.save()
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
# The end.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{% extends "base/header_content_footer.html" %}
|
|
2
|
+
{% load crispy_forms_tags %}
|
|
3
|
+
{% block title %}
|
|
4
|
+
{% trans "Create" %}
|
|
5
|
+
{% endblock %}
|
|
6
|
+
{% block content %}
|
|
7
|
+
<h2>{% trans "Create new account." %}</h2>
|
|
8
|
+
<form method="post" action="{% url 'profiles:create' %}">
|
|
9
|
+
{% csrf_token %} {{ form|crispy }}
|
|
10
|
+
<button type="submit button" class="btn btn-outline-primary">{% trans "Confirm" %}</button>
|
|
11
|
+
</form>
|
|
12
|
+
<p>
|
|
13
|
+
{% trans "Already have an account?" %}
|
|
14
|
+
<a href="{% url 'profiles:log_in' %}">{% trans "Login here" %}</a>
|
|
15
|
+
</p>
|
|
16
|
+
{% endblock %}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{% extends 'base/header_content_footer.html' %}
|
|
2
|
+
{% block content %}
|
|
3
|
+
<h1>
|
|
4
|
+
{% blocktrans with user_name=profile.user.username %} Hello, {{ user_name }}!
|
|
5
|
+
{% endblocktrans %}
|
|
6
|
+
</h1>
|
|
7
|
+
<p>Phone: {{ profile.phone }}</p>
|
|
8
|
+
<p>Date of Birth: {{ profile.date_of_birth }}</p>
|
|
9
|
+
<p>Affiliation: {{ profile.affiliation }}</p>
|
|
10
|
+
<p>Superior Department: {{ profile.superior_department }}</p>
|
|
11
|
+
<p>Date of Birth: {{ profile.date_of_birth }}</p>
|
|
12
|
+
<p>Address: {{ profile.address }}</p>
|
|
13
|
+
{% if profile.avatar %}<img src="{{ profile.avatar.url }}" alt="Avatar" />{% endif %}
|
|
14
|
+
{% endblock %}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{% extends "base/header_content_footer.html" %}
|
|
2
|
+
{% load crispy_forms_tags %}
|
|
3
|
+
{% block title %}
|
|
4
|
+
{% trans "Update Profile" %}
|
|
5
|
+
{% endblock %}
|
|
6
|
+
{% block content %}
|
|
7
|
+
<h2>{% trans "Update Profile." %}</h2>
|
|
8
|
+
<form method="post" action="{% url 'profiles:update' %}">
|
|
9
|
+
{% csrf_token %} {{ form|crispy }}
|
|
10
|
+
<button type="submit button" class="btn btn-outline-primary">{% trans "Update" %}</button>
|
|
11
|
+
</form>
|
|
12
|
+
{% endblock %}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{% extends "base/header_content_footer.html" %}
|
|
2
|
+
{% load crispy_forms_tags %}
|
|
3
|
+
{% block title %}
|
|
4
|
+
{% trans "Log in" %}
|
|
5
|
+
{% endblock %}
|
|
6
|
+
{% block content %}
|
|
7
|
+
<h2>{% trans "Log in" %}</h2>
|
|
8
|
+
{% if form.errors %}
|
|
9
|
+
<p>{% trans "Your username and password didn't match. Please try again." %}</p>
|
|
10
|
+
{% endif %}
|
|
11
|
+
<form method="post" action="{% url 'profiles:log_in' %}">
|
|
12
|
+
{% csrf_token %} {{ form|crispy }}
|
|
13
|
+
<input type="hidden" name="next" value="{{ request.GET.next }}" />
|
|
14
|
+
<button type="submit button" class="btn btn-outline-primary">{% trans "Log in" %}</button>
|
|
15
|
+
</form>
|
|
16
|
+
<p>
|
|
17
|
+
{% trans "Don't have an account?" %}
|
|
18
|
+
<a href="{% url 'profiles:create' %}">{% trans "Register here" %}</a>
|
|
19
|
+
</p>
|
|
20
|
+
{% endblock %}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{% extends "base/header_content_footer.html" %}
|
|
2
|
+
{% block title %}
|
|
3
|
+
{% trans
|
|
4
|
+
"Logged Out" %}
|
|
5
|
+
{% endblock %}
|
|
6
|
+
{% block content %}
|
|
7
|
+
<h2>{% trans "Logged Out" %}</h2>
|
|
8
|
+
<p>{% trans "You have been successfully logged out." %}</p>
|
|
9
|
+
<p>
|
|
10
|
+
<a href="{% url 'log_in' %}">{% trans "Log in again" %}</a>
|
|
11
|
+
</p>
|
|
12
|
+
{% endblock %}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from django.contrib import admin
|
|
2
|
+
from django.urls import include, path
|
|
3
|
+
|
|
4
|
+
from . import views
|
|
5
|
+
|
|
6
|
+
app_name = "profiles"
|
|
7
|
+
|
|
8
|
+
urlpatterns = [
|
|
9
|
+
path("detail", views.profile_edit, name="detail"),
|
|
10
|
+
path("log_out", views.profile_log_out, name="log_out"),
|
|
11
|
+
path("create", views.profile_new, name="create"),
|
|
12
|
+
path("log_in", views.profile_log_in, name="log_in"),
|
|
13
|
+
path("update", views.profile_edit, name="update"),
|
|
14
|
+
]
|
|
15
|
+
# The end.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
from django.contrib.auth import authenticate, login, logout
|
|
2
|
+
from django.contrib.auth.decorators import login_required
|
|
3
|
+
from django.shortcuts import redirect, render
|
|
4
|
+
from django.urls import reverse_lazy
|
|
5
|
+
from django.views.generic import CreateView
|
|
6
|
+
from fnschool.settings import LOGIN_URL
|
|
7
|
+
|
|
8
|
+
from .forms import ProfileForm, ProfileLoginForm
|
|
9
|
+
|
|
10
|
+
# Create your views here.
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def profile_new(request):
|
|
14
|
+
form = None
|
|
15
|
+
if request.method == "POST":
|
|
16
|
+
form = ProfileForm(request.POST)
|
|
17
|
+
if form.is_valid():
|
|
18
|
+
user = form.save(commit=False)
|
|
19
|
+
user.set_password(form.cleaned_data["password"])
|
|
20
|
+
user.username = form.cleaned_data["username"]
|
|
21
|
+
user.save()
|
|
22
|
+
login(request, user)
|
|
23
|
+
return redirect("home")
|
|
24
|
+
else:
|
|
25
|
+
form = ProfileForm()
|
|
26
|
+
|
|
27
|
+
return render(request, "profiles/create.html", {"form": form})
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def profile_log_in(request):
|
|
31
|
+
if request.method == "POST":
|
|
32
|
+
form = ProfileLoginForm(request, data=request.POST)
|
|
33
|
+
if form.is_valid():
|
|
34
|
+
username = form.cleaned_data.get("username")
|
|
35
|
+
password = form.cleaned_data.get("password")
|
|
36
|
+
user = authenticate(request, username=username, password=password)
|
|
37
|
+
if user is not None:
|
|
38
|
+
login(request, user)
|
|
39
|
+
next_url = request.POST.get("next") or reverse_lazy("home")
|
|
40
|
+
return redirect(next_url)
|
|
41
|
+
else:
|
|
42
|
+
form = ProfileLoginForm()
|
|
43
|
+
return render(request, "profiles/log_in.html", {"form": form})
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def profile_log_out(request):
|
|
47
|
+
logout(request)
|
|
48
|
+
return redirect("home")
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
@login_required
|
|
52
|
+
def profile_edit(request):
|
|
53
|
+
if request.method == "POST":
|
|
54
|
+
form = ProfileForm(request.POST, instance=request.user)
|
|
55
|
+
if form.is_valid():
|
|
56
|
+
form.save()
|
|
57
|
+
return redirect("home")
|
|
58
|
+
else:
|
|
59
|
+
form = ProfileForm(instance=request.user)
|
|
60
|
+
return render(request, "profiles/edit.html", {"form": form})
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
# The end.
|