fnschool 20250109.80500.803__py3-none-any.whl → 20251011.80531.840__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.

Files changed (276) hide show
  1. fnschoo1/__init__.py +52 -0
  2. fnschoo1/canteen/admin.py +3 -0
  3. fnschoo1/canteen/apps.py +6 -0
  4. fnschoo1/canteen/forms.py +84 -0
  5. fnschoo1/canteen/migrations/0001_initial.py +119 -0
  6. fnschoo1/canteen/migrations/0002_ingredient_is_disabled.py +20 -0
  7. fnschoo1/canteen/migrations/0003_consumption_is_disabled_alter_ingredient_is_disabled.py +23 -0
  8. fnschoo1/canteen/migrations/0004_alter_ingredient_name_category_and_more.py +66 -0
  9. fnschoo1/canteen/migrations/0005_alter_category_created_at_alter_category_name_and_more.py +41 -0
  10. fnschoo1/canteen/migrations/0006_category_is_disabled_alter_category_user_and_more.py +49 -0
  11. fnschoo1/canteen/migrations/0007_alter_consumption_amount_used_and_more.py +30 -0
  12. fnschoo1/canteen/migrations/0008_category_abbreviation_mealtype.py +67 -0
  13. fnschoo1/canteen/migrations/0009_alter_category_abbreviation_and_more.py +55 -0
  14. fnschoo1/canteen/migrations/0010_alter_consumption_options_alter_ingredient_options_and_more.py +215 -0
  15. fnschoo1/canteen/migrations/0011_category_pin_to_consumptions_top.py +23 -0
  16. fnschoo1/canteen/migrations/0012_alter_ingredient_storage_date.py +18 -0
  17. fnschoo1/canteen/models.py +179 -0
  18. fnschoo1/canteen/templates/canteen/category/create.html +17 -0
  19. fnschoo1/canteen/templates/canteen/category/delete.html +61 -0
  20. fnschoo1/canteen/templates/canteen/category/list.html +63 -0
  21. fnschoo1/canteen/templates/canteen/category/update.html +23 -0
  22. fnschoo1/canteen/templates/canteen/close.html +11 -0
  23. fnschoo1/canteen/templates/canteen/consumption/_create.html +19 -0
  24. fnschoo1/canteen/templates/canteen/consumption/create.html +456 -0
  25. fnschoo1/canteen/templates/canteen/ingredient/close.html +11 -0
  26. fnschoo1/canteen/templates/canteen/ingredient/create.html +19 -0
  27. fnschoo1/canteen/templates/canteen/ingredient/create_one.html +17 -0
  28. fnschoo1/canteen/templates/canteen/ingredient/delete.html +41 -0
  29. fnschoo1/canteen/templates/canteen/ingredient/list.html +128 -0
  30. fnschoo1/canteen/templates/canteen/ingredient/update.html +23 -0
  31. fnschoo1/canteen/templates/canteen/meal_type/create.html +17 -0
  32. fnschoo1/canteen/templates/canteen/meal_type/delete.html +56 -0
  33. fnschoo1/canteen/templates/canteen/meal_type/list.html +59 -0
  34. fnschoo1/canteen/templates/canteen/meal_type/update.html +23 -0
  35. fnschoo1/canteen/tests.py +3 -0
  36. fnschoo1/canteen/urls.py +116 -0
  37. fnschoo1/canteen/views.py +814 -0
  38. fnschoo1/canteen/workbook/generate.py +2098 -0
  39. fnschoo1/db.sqlite3 +0 -0
  40. fnschoo1/fnschool/__init__.py +13 -0
  41. fnschoo1/fnschool/asgi.py +16 -0
  42. fnschoo1/fnschool/settings.py +167 -0
  43. fnschoo1/fnschool/templatetags/fnschool_tags.py +27 -0
  44. fnschoo1/fnschool/urls.py +30 -0
  45. fnschoo1/fnschool/views.py +9 -0
  46. fnschoo1/fnschool/wsgi.py +16 -0
  47. fnschoo1/locale/en/LC_MESSAGES/django.mo +0 -0
  48. fnschoo1/locale/zh_Hans/LC_MESSAGES/django.mo +0 -0
  49. fnschoo1/manage.py +25 -0
  50. fnschoo1/profiles/admin.py +27 -0
  51. fnschoo1/profiles/apps.py +12 -0
  52. fnschoo1/profiles/forms.py +67 -0
  53. fnschoo1/profiles/migrations/0001_initial.py +192 -0
  54. fnschoo1/profiles/migrations/0002_alter_profile_bio.py +20 -0
  55. fnschoo1/profiles/migrations/0003_alter_profile_options_alter_profile_address_and_more.py +67 -0
  56. fnschoo1/profiles/migrations/0004_profile_gender.py +26 -0
  57. fnschoo1/profiles/migrations/0005_alter_profile_gender.py +23 -0
  58. fnschoo1/profiles/models.py +60 -0
  59. fnschoo1/profiles/signals.py +20 -0
  60. fnschoo1/profiles/templates/profiles/create.html +16 -0
  61. fnschoo1/profiles/templates/profiles/detail.html +14 -0
  62. fnschoo1/profiles/templates/profiles/edit.html +12 -0
  63. fnschoo1/profiles/templates/profiles/log_in.html +20 -0
  64. fnschoo1/profiles/templates/profiles/log_out.html +12 -0
  65. fnschoo1/profiles/tests.py +3 -0
  66. fnschoo1/profiles/urls.py +15 -0
  67. fnschoo1/profiles/views.py +63 -0
  68. fnschoo1/static/css/bootstrap.min.css +11776 -0
  69. fnschoo1/static/css/fnschool.css +26 -0
  70. fnschoo1/static/js/bootstrap.bundle.min.js +4223 -0
  71. fnschoo1/static/js/bootstrap.min.js +2919 -0
  72. fnschoo1/static/js/fnschool.js +84 -0
  73. fnschoo1/static/js/jquery.min.js +5413 -0
  74. fnschoo1/static/js/jquery.slim.min.js +4331 -0
  75. fnschoo1/static/js/popper.min.js +1306 -0
  76. fnschoo1/static_collected/admin/css/autocomplete.css +377 -0
  77. fnschoo1/static_collected/admin/css/base.css +1224 -0
  78. fnschoo1/static_collected/admin/css/changelists.css +334 -0
  79. fnschoo1/static_collected/admin/css/dark_mode.css +136 -0
  80. fnschoo1/static_collected/admin/css/dashboard.css +30 -0
  81. fnschoo1/static_collected/admin/css/forms.css +546 -0
  82. fnschoo1/static_collected/admin/css/login.css +62 -0
  83. fnschoo1/static_collected/admin/css/nav_sidebar.css +145 -0
  84. fnschoo1/static_collected/admin/css/responsive.css +1043 -0
  85. fnschoo1/static_collected/admin/css/responsive_rtl.css +84 -0
  86. fnschoo1/static_collected/admin/css/rtl.css +311 -0
  87. fnschoo1/static_collected/admin/css/vendor/select2/select2.css +708 -0
  88. fnschoo1/static_collected/admin/css/vendor/select2/select2.min.css +1 -0
  89. fnschoo1/static_collected/admin/css/widgets.css +639 -0
  90. fnschoo1/static_collected/admin/js/SelectBox.js +128 -0
  91. fnschoo1/static_collected/admin/js/SelectFilter2.js +503 -0
  92. fnschoo1/static_collected/admin/js/actions.js +232 -0
  93. fnschoo1/static_collected/admin/js/admin/DateTimeShortcuts.js +496 -0
  94. fnschoo1/static_collected/admin/js/admin/RelatedObjectLookups.js +276 -0
  95. fnschoo1/static_collected/admin/js/autocomplete.js +33 -0
  96. fnschoo1/static_collected/admin/js/calendar.js +251 -0
  97. fnschoo1/static_collected/admin/js/cancel.js +29 -0
  98. fnschoo1/static_collected/admin/js/change_form.js +21 -0
  99. fnschoo1/static_collected/admin/js/collapse.js +43 -0
  100. fnschoo1/static_collected/admin/js/core.js +174 -0
  101. fnschoo1/static_collected/admin/js/filters.js +37 -0
  102. fnschoo1/static_collected/admin/js/inlines.js +439 -0
  103. fnschoo1/static_collected/admin/js/jquery.init.js +8 -0
  104. fnschoo1/static_collected/admin/js/nav_sidebar.js +81 -0
  105. fnschoo1/static_collected/admin/js/popup_response.js +24 -0
  106. fnschoo1/static_collected/admin/js/prepopulate.js +43 -0
  107. fnschoo1/static_collected/admin/js/prepopulate_init.js +20 -0
  108. fnschoo1/static_collected/admin/js/theme.js +57 -0
  109. fnschoo1/static_collected/admin/js/urlify.js +529 -0
  110. fnschoo1/static_collected/admin/js/vendor/jquery/jquery.js +10913 -0
  111. fnschoo1/static_collected/admin/js/vendor/jquery/jquery.min.js +2 -0
  112. fnschoo1/static_collected/admin/js/vendor/select2/i18n/af.js +43 -0
  113. fnschoo1/static_collected/admin/js/vendor/select2/i18n/ar.js +36 -0
  114. fnschoo1/static_collected/admin/js/vendor/select2/i18n/az.js +33 -0
  115. fnschoo1/static_collected/admin/js/vendor/select2/i18n/bg.js +38 -0
  116. fnschoo1/static_collected/admin/js/vendor/select2/i18n/bn.js +39 -0
  117. fnschoo1/static_collected/admin/js/vendor/select2/i18n/bs.js +48 -0
  118. fnschoo1/static_collected/admin/js/vendor/select2/i18n/ca.js +41 -0
  119. fnschoo1/static_collected/admin/js/vendor/select2/i18n/cs.js +62 -0
  120. fnschoo1/static_collected/admin/js/vendor/select2/i18n/da.js +37 -0
  121. fnschoo1/static_collected/admin/js/vendor/select2/i18n/de.js +41 -0
  122. fnschoo1/static_collected/admin/js/vendor/select2/i18n/dsb.js +51 -0
  123. fnschoo1/static_collected/admin/js/vendor/select2/i18n/el.js +43 -0
  124. fnschoo1/static_collected/admin/js/vendor/select2/i18n/en.js +41 -0
  125. fnschoo1/static_collected/admin/js/vendor/select2/i18n/es.js +41 -0
  126. fnschoo1/static_collected/admin/js/vendor/select2/i18n/et.js +38 -0
  127. fnschoo1/static_collected/admin/js/vendor/select2/i18n/eu.js +45 -0
  128. fnschoo1/static_collected/admin/js/vendor/select2/i18n/fa.js +42 -0
  129. fnschoo1/static_collected/admin/js/vendor/select2/i18n/fi.js +42 -0
  130. fnschoo1/static_collected/admin/js/vendor/select2/i18n/fr.js +43 -0
  131. fnschoo1/static_collected/admin/js/vendor/select2/i18n/gl.js +40 -0
  132. fnschoo1/static_collected/admin/js/vendor/select2/i18n/he.js +44 -0
  133. fnschoo1/static_collected/admin/js/vendor/select2/i18n/hi.js +40 -0
  134. fnschoo1/static_collected/admin/js/vendor/select2/i18n/hr.js +45 -0
  135. fnschoo1/static_collected/admin/js/vendor/select2/i18n/hsb.js +51 -0
  136. fnschoo1/static_collected/admin/js/vendor/select2/i18n/hu.js +44 -0
  137. fnschoo1/static_collected/admin/js/vendor/select2/i18n/hy.js +40 -0
  138. fnschoo1/static_collected/admin/js/vendor/select2/i18n/id.js +36 -0
  139. fnschoo1/static_collected/admin/js/vendor/select2/i18n/is.js +37 -0
  140. fnschoo1/static_collected/admin/js/vendor/select2/i18n/it.js +43 -0
  141. fnschoo1/static_collected/admin/js/vendor/select2/i18n/ja.js +40 -0
  142. fnschoo1/static_collected/admin/js/vendor/select2/i18n/ka.js +42 -0
  143. fnschoo1/static_collected/admin/js/vendor/select2/i18n/km.js +38 -0
  144. fnschoo1/static_collected/admin/js/vendor/select2/i18n/ko.js +42 -0
  145. fnschoo1/static_collected/admin/js/vendor/select2/i18n/lt.js +45 -0
  146. fnschoo1/static_collected/admin/js/vendor/select2/i18n/lv.js +41 -0
  147. fnschoo1/static_collected/admin/js/vendor/select2/i18n/mk.js +42 -0
  148. fnschoo1/static_collected/admin/js/vendor/select2/i18n/ms.js +38 -0
  149. fnschoo1/static_collected/admin/js/vendor/select2/i18n/nb.js +38 -0
  150. fnschoo1/static_collected/admin/js/vendor/select2/i18n/ne.js +44 -0
  151. fnschoo1/static_collected/admin/js/vendor/select2/i18n/nl.js +46 -0
  152. fnschoo1/static_collected/admin/js/vendor/select2/i18n/pl.js +43 -0
  153. fnschoo1/static_collected/admin/js/vendor/select2/i18n/ps.js +41 -0
  154. fnschoo1/static_collected/admin/js/vendor/select2/i18n/pt-BR.js +39 -0
  155. fnschoo1/static_collected/admin/js/vendor/select2/i18n/pt.js +41 -0
  156. fnschoo1/static_collected/admin/js/vendor/select2/i18n/ro.js +43 -0
  157. fnschoo1/static_collected/admin/js/vendor/select2/i18n/ru.js +48 -0
  158. fnschoo1/static_collected/admin/js/vendor/select2/i18n/sk.js +61 -0
  159. fnschoo1/static_collected/admin/js/vendor/select2/i18n/sl.js +41 -0
  160. fnschoo1/static_collected/admin/js/vendor/select2/i18n/sq.js +43 -0
  161. fnschoo1/static_collected/admin/js/vendor/select2/i18n/sr-Cyrl.js +48 -0
  162. fnschoo1/static_collected/admin/js/vendor/select2/i18n/sr.js +48 -0
  163. fnschoo1/static_collected/admin/js/vendor/select2/i18n/sv.js +40 -0
  164. fnschoo1/static_collected/admin/js/vendor/select2/i18n/th.js +36 -0
  165. fnschoo1/static_collected/admin/js/vendor/select2/i18n/tk.js +36 -0
  166. fnschoo1/static_collected/admin/js/vendor/select2/i18n/tr.js +40 -0
  167. fnschoo1/static_collected/admin/js/vendor/select2/i18n/uk.js +59 -0
  168. fnschoo1/static_collected/admin/js/vendor/select2/i18n/vi.js +37 -0
  169. fnschoo1/static_collected/admin/js/vendor/select2/i18n/zh-CN.js +36 -0
  170. fnschoo1/static_collected/admin/js/vendor/select2/i18n/zh-TW.js +33 -0
  171. fnschoo1/static_collected/admin/js/vendor/select2/select2.full.js +7115 -0
  172. fnschoo1/static_collected/admin/js/vendor/select2/select2.full.min.js +2 -0
  173. fnschoo1/static_collected/admin/js/vendor/xregexp/xregexp.js +4993 -0
  174. fnschoo1/static_collected/admin/js/vendor/xregexp/xregexp.min.js +160 -0
  175. fnschoo1/static_collected/css/bootstrap.min.css +11776 -0
  176. fnschoo1/static_collected/css/fnschool.css +26 -0
  177. fnschoo1/static_collected/js/bootstrap.bundle.min.js +4223 -0
  178. fnschoo1/static_collected/js/bootstrap.min.js +2919 -0
  179. fnschoo1/static_collected/js/fnschool.js +84 -0
  180. fnschoo1/static_collected/js/jquery.min.js +5413 -0
  181. fnschoo1/static_collected/js/jquery.slim.min.js +4331 -0
  182. fnschoo1/static_collected/js/popper.min.js +1306 -0
  183. fnschoo1/templates/base/_css.html +1 -0
  184. fnschoo1/templates/base/_js.html +15 -0
  185. fnschoo1/templates/base/content.html +30 -0
  186. fnschoo1/templates/base/header_content_footer.html +35 -0
  187. fnschoo1/templates/close.html +11 -0
  188. fnschoo1/templates/home.html +51 -0
  189. fnschoo1/templates/includes/_footer.html +39 -0
  190. fnschoo1/templates/includes/_header.html +77 -0
  191. fnschoo1/templates/includes/_navigation.html +0 -0
  192. fnschoo1/templates/includes/_paginator.html +27 -0
  193. fnschoo1/templates/registration/logged_out.html +0 -0
  194. fnschoo1/templates/registration/login.html +0 -0
  195. fnschool-20251011.80531.840.dist-info/METADATA +179 -0
  196. fnschool-20251011.80531.840.dist-info/RECORD +207 -0
  197. {fnschool-20250109.80500.803.dist-info → fnschool-20251011.80531.840.dist-info}/WHEEL +1 -1
  198. fnschool-20251011.80531.840.dist-info/entry_points.txt +2 -0
  199. fnschool-20251011.80531.840.dist-info/top_level.txt +1 -0
  200. fnschool/__init__.py +0 -35
  201. fnschool/__main__.py +0 -16
  202. fnschool/app.py +0 -103
  203. fnschool/canteen/__init__.py +0 -3
  204. fnschool/canteen/__main__.py +0 -3
  205. fnschool/canteen/bill.py +0 -253
  206. fnschool/canteen/canteen.py +0 -1
  207. fnschool/canteen/canteen.toml +0 -61
  208. fnschool/canteen/config.py +0 -10
  209. fnschool/canteen/consuming.py +0 -53
  210. fnschool/canteen/currency.py +0 -17
  211. fnschool/canteen/data/bill.i18n.xlsx +0 -0
  212. fnschool/canteen/data/bill.xlsx +0 -0
  213. fnschool/canteen/data/consuming.xlsx +0 -0
  214. fnschool/canteen/data/purchase_list.xlsx +0 -0
  215. fnschool/canteen/entry.py +0 -40
  216. fnschool/canteen/food.py +0 -206
  217. fnschool/canteen/food_classes.py +0 -33
  218. fnschool/canteen/food_classes.toml +0 -64
  219. fnschool/canteen/operator.py +0 -91
  220. fnschool/canteen/path.py +0 -28
  221. fnschool/canteen/spreadsheet/base.py +0 -212
  222. fnschool/canteen/spreadsheet/consuming.py +0 -310
  223. fnschool/canteen/spreadsheet/consumingsum.py +0 -76
  224. fnschool/canteen/spreadsheet/cover.py +0 -64
  225. fnschool/canteen/spreadsheet/ctspreadsheet.py +0 -351
  226. fnschool/canteen/spreadsheet/food.py +0 -680
  227. fnschool/canteen/spreadsheet/inventory.py +0 -375
  228. fnschool/canteen/spreadsheet/merging.py +0 -340
  229. fnschool/canteen/spreadsheet/preconsuming.py +0 -329
  230. fnschool/canteen/spreadsheet/purchasing.py +0 -885
  231. fnschool/canteen/spreadsheet/purchasingsum.py +0 -110
  232. fnschool/canteen/spreadsheet/spreadsheet.py +0 -363
  233. fnschool/canteen/spreadsheet/translating.py +0 -12
  234. fnschool/canteen/spreadsheet/unwarehousing.py +0 -178
  235. fnschool/canteen/spreadsheet/unwarehousingsum.py +0 -11
  236. fnschool/canteen/spreadsheet/warehousing.py +0 -360
  237. fnschool/canteen/spreadsheet/workbook.py +0 -17
  238. fnschool/canteen/test.py +0 -97
  239. fnschool/config.py +0 -48
  240. fnschool/entry.py +0 -67
  241. fnschool/exam/__init__.py +0 -8
  242. fnschool/exam/data/parental_emails.xlsx +0 -0
  243. fnschool/exam/data/score.xlsx +0 -0
  244. fnschool/exam/email.py +0 -349
  245. fnschool/exam/entry.py +0 -36
  246. fnschool/exam/language.py +0 -19
  247. fnschool/exam/path.py +0 -24
  248. fnschool/exam/score.py +0 -1191
  249. fnschool/exam/subject.py +0 -20
  250. fnschool/exam/teacher.py +0 -54
  251. fnschool/external.py +0 -89
  252. fnschool/games/__init__.py +0 -1
  253. fnschool/games/__main__.py +0 -1
  254. fnschool/games/games.py +0 -1
  255. fnschool/inoutput.py +0 -97
  256. fnschool/language.py +0 -40
  257. fnschool/locales/en_US/LC_MESSAGES/fnschool.mo +0 -0
  258. fnschool/locales/zh_CN/LC_MESSAGES/fnschool.mo +0 -0
  259. fnschool/locales/zh_HK/LC_MESSAGES/fnschool.mo +0 -0
  260. fnschool/locales/zh_SG/LC_MESSAGES/fnschool.mo +0 -0
  261. fnschool/locales/zh_TW/LC_MESSAGES/fnschool.mo +0 -0
  262. fnschool/path.py +0 -45
  263. fnschool/test.py +0 -24
  264. fnschool/user.py +0 -262
  265. fnschool-20250109.80500.803.dist-info/METADATA +0 -342
  266. fnschool-20250109.80500.803.dist-info/RECORD +0 -78
  267. fnschool-20250109.80500.803.dist-info/entry_points.txt +0 -5
  268. fnschool-20250109.80500.803.dist-info/top_level.txt +0 -1
  269. /fnschool/canteen/consume.py → /fnschoo1/canteen/__init__.py +0 -0
  270. /fnschool/canteen/food_recount.toml → /fnschoo1/canteen/migrations/__init__.py +0 -0
  271. {fnschool/canteen/spreadsheet → fnschoo1/canteen/workbook}/__init__.py +0 -0
  272. /fnschool/exam/__main__.py → /fnschoo1/fnschool/templatetags/__init__.py +0 -0
  273. /fnschool/canteen/food_recounts.toml → /fnschoo1/profiles/__init__.py +0 -0
  274. /fnschool/canteen/warehouse.py → /fnschoo1/profiles/migrations/__init__.py +0 -0
  275. /fnschool/canteen/workbook.toml → /fnschoo1/templates/base/_content.html +0 -0
  276. {fnschool-20250109.80500.803.dist-info → fnschool-20251011.80531.840.dist-info/licenses}/LICENSE +0 -0
fnschoo1/__init__.py ADDED
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env python3
2
+ """Django's command-line utility for administrative tasks."""
3
+ import os
4
+ import platform
5
+ import random
6
+ import sys
7
+ from pathlib import Path
8
+
9
+ __version__ = "20251011.80531.840"
10
+ FNSCHOOL_PATH = Path(__file__).parent
11
+ if FNSCHOOL_PATH.as_posix() not in sys.path:
12
+ sys.path.insert(0, FNSCHOOL_PATH.as_posix())
13
+
14
+ system_name = platform.system()
15
+ is_linux = False
16
+ is_windows = False
17
+ is_macos = False
18
+
19
+ if system_name == "Linux":
20
+ is_linux = True
21
+ elif system_name == "Windows":
22
+ is_windows = True
23
+ elif system_name == "Darwin":
24
+ is_macos = True
25
+
26
+
27
+ def main():
28
+ """Run administrative tasks."""
29
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "fnschool.settings")
30
+ try:
31
+ from django.core.management import execute_from_command_line
32
+ except ImportError as exc:
33
+ raise ImportError(
34
+ "Couldn't import Django. Are you sure it's installed and "
35
+ "available on your PYTHONPATH environment variable? Did you "
36
+ "forget to activate a virtual environment?"
37
+ ) from exc
38
+
39
+ if not "runserver" in sys.argv:
40
+ local_port = str(random.randint(8080, 65530))
41
+ local_url = "http://127.0.0.1:" + local_port
42
+ sys.argv.append("runserver")
43
+ sys.argv.append(str(local_port))
44
+ try:
45
+ if is_windows:
46
+ os.startfile(local_url)
47
+ else:
48
+ os.system("open " + local_url)
49
+ except Exception as e:
50
+ print(e)
51
+
52
+ execute_from_command_line(sys.argv)
@@ -0,0 +1,3 @@
1
+ from django.contrib import admin
2
+
3
+ # Register your models here.
@@ -0,0 +1,6 @@
1
+ from django.apps import AppConfig
2
+
3
+
4
+ class CanteenConfig(AppConfig):
5
+ default_auto_field = "django.db.models.BigAutoField"
6
+ name = "canteen"
@@ -0,0 +1,84 @@
1
+ from datetime import date, datetime
2
+
3
+ from django import forms
4
+ from fnschool import _
5
+
6
+ from .models import Category, Consumption, Ingredient, MealType
7
+
8
+
9
+ class PurchasedIngredientsWorkBookForm(forms.Form):
10
+ workbook_file = forms.FileField(
11
+ label=_("Select a Spreadsheet File"),
12
+ help_text=_("Office Open XML Spreadsheet only. (*.xlsx)"),
13
+ widget=forms.ClearableFileInput(attrs={"accept": ".xlsx"}),
14
+ )
15
+
16
+
17
+ class IngredientForm(forms.ModelForm):
18
+ class Meta:
19
+ model = Ingredient
20
+ fields = [
21
+ f.name
22
+ for f in Ingredient._meta.fields
23
+ if f.name not in ["id", "user"]
24
+ ]
25
+
26
+ current_year = date.today().year
27
+ year_range = list(range(current_year - 100, current_year + 1))
28
+ widgets = {
29
+ "storage_date": forms.SelectDateWidget(
30
+ years=year_range,
31
+ attrs={
32
+ "style": "width: 33.33%; display: inline-block;",
33
+ },
34
+ ),
35
+ }
36
+
37
+
38
+ class ConsumptionForm(forms.ModelForm):
39
+
40
+ def __init__(self, *args, **kwargs):
41
+ super().__init__(*args, **kwargs)
42
+ for name in self.fields:
43
+ self.fields[name].label = ""
44
+ self.fields[name].widget.attrs.update(
45
+ {
46
+ "id": f"id_{name}_{self.instance.ingredient.id}",
47
+ "class": "form-control",
48
+ }
49
+ )
50
+ self.fields[name].disabled = self.instance.is_disabled
51
+
52
+ class Meta:
53
+ model = Consumption
54
+ fields = "__all__"
55
+ widgets = {
56
+ "amount_used": forms.NumberInput(
57
+ attrs={
58
+ "style": "width: 109px; text-align: center; font-family: Mono;"
59
+ }
60
+ ),
61
+ "date_of_using": forms.HiddenInput(),
62
+ "ingredient": forms.HiddenInput(),
63
+ "is_disabled": forms.HiddenInput(),
64
+ }
65
+
66
+
67
+ class CategoryForm(forms.ModelForm):
68
+ class Meta:
69
+ model = Category
70
+ fields = [
71
+ "name",
72
+ "abbreviation",
73
+ "pin_to_consumptions_top",
74
+ "is_disabled",
75
+ ]
76
+
77
+
78
+ class MealTypeForm(forms.ModelForm):
79
+ class Meta:
80
+ model = MealType
81
+ fields = ["name", "abbreviation", "is_disabled"]
82
+
83
+
84
+ # The end.
@@ -0,0 +1,119 @@
1
+ # Generated by Django 4.2.24 on 2025-09-25 19:43
2
+
3
+ import django.db.models.deletion
4
+ from django.conf import settings
5
+ from django.db import migrations, models
6
+
7
+
8
+ class Migration(migrations.Migration):
9
+
10
+ initial = True
11
+
12
+ dependencies = [
13
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
14
+ ]
15
+
16
+ operations = [
17
+ migrations.CreateModel(
18
+ name="Ingredient",
19
+ fields=[
20
+ (
21
+ "id",
22
+ models.BigAutoField(
23
+ auto_created=True,
24
+ primary_key=True,
25
+ serialize=False,
26
+ verbose_name="ID",
27
+ ),
28
+ ),
29
+ ("storage_date", models.DateField(verbose_name="入库日期")),
30
+ (
31
+ "name",
32
+ models.CharField(max_length=100, verbose_name="食材名"),
33
+ ),
34
+ (
35
+ "meal_type",
36
+ models.CharField(max_length=50, verbose_name="餐类"),
37
+ ),
38
+ (
39
+ "category",
40
+ models.CharField(max_length=50, verbose_name="食材大类"),
41
+ ),
42
+ (
43
+ "quantity",
44
+ models.DecimalField(
45
+ decimal_places=2, max_digits=10, verbose_name="数量"
46
+ ),
47
+ ),
48
+ (
49
+ "total_price",
50
+ models.DecimalField(
51
+ decimal_places=2, max_digits=10, verbose_name="总价"
52
+ ),
53
+ ),
54
+ (
55
+ "quantity_unit_name",
56
+ models.CharField(
57
+ blank=True,
58
+ max_length=20,
59
+ null=True,
60
+ verbose_name="数量单位",
61
+ ),
62
+ ),
63
+ (
64
+ "is_ignorable",
65
+ models.BooleanField(
66
+ default=False, verbose_name="是不用入库的"
67
+ ),
68
+ ),
69
+ (
70
+ "user",
71
+ models.ForeignKey(
72
+ on_delete=django.db.models.deletion.CASCADE,
73
+ related_name="ingredients",
74
+ to=settings.AUTH_USER_MODEL,
75
+ verbose_name="用户",
76
+ ),
77
+ ),
78
+ ],
79
+ options={
80
+ "verbose_name": "Ingredient",
81
+ "verbose_name_plural": "食材列表",
82
+ },
83
+ ),
84
+ migrations.CreateModel(
85
+ name="Consumption",
86
+ fields=[
87
+ (
88
+ "id",
89
+ models.BigAutoField(
90
+ auto_created=True,
91
+ primary_key=True,
92
+ serialize=False,
93
+ verbose_name="ID",
94
+ ),
95
+ ),
96
+ ("date_of_using", models.DateField(verbose_name="日期")),
97
+ (
98
+ "amount_used",
99
+ models.DecimalField(
100
+ decimal_places=2, max_digits=10, verbose_name="消耗数量"
101
+ ),
102
+ ),
103
+ (
104
+ "ingredient",
105
+ models.ForeignKey(
106
+ on_delete=django.db.models.deletion.CASCADE,
107
+ related_name="consumptions",
108
+ to="canteen.ingredient",
109
+ verbose_name="食材",
110
+ ),
111
+ ),
112
+ ],
113
+ options={
114
+ "verbose_name": "消耗记录",
115
+ "verbose_name_plural": "消耗记录列表",
116
+ "ordering": ["-date_of_using"],
117
+ },
118
+ ),
119
+ ]
@@ -0,0 +1,20 @@
1
+ # Generated by Django 4.2.24 on 2025-09-27 09:37
2
+
3
+ from django.db import migrations, models
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+
8
+ dependencies = [
9
+ ("canteen", "0001_initial"),
10
+ ]
11
+
12
+ operations = [
13
+ migrations.AddField(
14
+ model_name="ingredient",
15
+ name="is_disabled",
16
+ field=models.BooleanField(
17
+ default=False, verbose_name="Is disabled"
18
+ ),
19
+ ),
20
+ ]
@@ -0,0 +1,23 @@
1
+ # Generated by Django 4.2.24 on 2025-09-27 15:48
2
+
3
+ from django.db import migrations, models
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+
8
+ dependencies = [
9
+ ("canteen", "0002_ingredient_is_disabled"),
10
+ ]
11
+
12
+ operations = [
13
+ migrations.AddField(
14
+ model_name="consumption",
15
+ name="is_disabled",
16
+ field=models.BooleanField(default=False, verbose_name="已禁用"),
17
+ ),
18
+ migrations.AlterField(
19
+ model_name="ingredient",
20
+ name="is_disabled",
21
+ field=models.BooleanField(default=False, verbose_name="已禁用"),
22
+ ),
23
+ ]
@@ -0,0 +1,66 @@
1
+ # Generated by Django 4.2.25 on 2025-10-04 01:43
2
+
3
+ import django.db.models.deletion
4
+ from django.conf import settings
5
+ from django.db import migrations, models
6
+
7
+
8
+ class Migration(migrations.Migration):
9
+
10
+ dependencies = [
11
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
12
+ (
13
+ "canteen",
14
+ "0003_consumption_is_disabled_alter_ingredient_is_disabled",
15
+ ),
16
+ ]
17
+
18
+ operations = [
19
+ migrations.AlterField(
20
+ model_name="ingredient",
21
+ name="name",
22
+ field=models.CharField(
23
+ max_length=100, verbose_name="ingredient name"
24
+ ),
25
+ ),
26
+ migrations.CreateModel(
27
+ name="Category",
28
+ fields=[
29
+ (
30
+ "id",
31
+ models.BigAutoField(
32
+ auto_created=True,
33
+ primary_key=True,
34
+ serialize=False,
35
+ verbose_name="ID",
36
+ ),
37
+ ),
38
+ (
39
+ "name",
40
+ models.CharField(
41
+ max_length=100, verbose_name="Category name"
42
+ ),
43
+ ),
44
+ ("created_at", models.DateField(verbose_name="Creating Date")),
45
+ (
46
+ "user",
47
+ models.ForeignKey(
48
+ on_delete=django.db.models.deletion.CASCADE,
49
+ related_name="Categories",
50
+ to=settings.AUTH_USER_MODEL,
51
+ verbose_name="Ingredient category",
52
+ ),
53
+ ),
54
+ ],
55
+ ),
56
+ migrations.AlterField(
57
+ model_name="ingredient",
58
+ name="category",
59
+ field=models.ForeignKey(
60
+ on_delete=django.db.models.deletion.PROTECT,
61
+ related_name="ingredients",
62
+ to="canteen.category",
63
+ verbose_name="食材大类",
64
+ ),
65
+ ),
66
+ ]
@@ -0,0 +1,41 @@
1
+ # Generated by Django 4.2.25 on 2025-10-04 05:08
2
+
3
+ import django.db.models.deletion
4
+ from django.conf import settings
5
+ from django.db import migrations, models
6
+
7
+
8
+ class Migration(migrations.Migration):
9
+
10
+ dependencies = [
11
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
12
+ ("canteen", "0004_alter_ingredient_name_category_and_more"),
13
+ ]
14
+
15
+ operations = [
16
+ migrations.AlterField(
17
+ model_name="category",
18
+ name="created_at",
19
+ field=models.DateField(verbose_name="创建日期"),
20
+ ),
21
+ migrations.AlterField(
22
+ model_name="category",
23
+ name="name",
24
+ field=models.CharField(max_length=100, verbose_name="食材大类名"),
25
+ ),
26
+ migrations.AlterField(
27
+ model_name="category",
28
+ name="user",
29
+ field=models.ForeignKey(
30
+ on_delete=django.db.models.deletion.CASCADE,
31
+ related_name="Categories",
32
+ to=settings.AUTH_USER_MODEL,
33
+ verbose_name="食材大类",
34
+ ),
35
+ ),
36
+ migrations.AlterField(
37
+ model_name="ingredient",
38
+ name="name",
39
+ field=models.CharField(max_length=100, verbose_name="食材名"),
40
+ ),
41
+ ]
@@ -0,0 +1,49 @@
1
+ # Generated by Django 4.2.25 on 2025-10-04 20:44
2
+
3
+ from decimal import Decimal
4
+
5
+ import django.core.validators
6
+ import django.db.models.deletion
7
+ from django.conf import settings
8
+ from django.db import migrations, models
9
+
10
+
11
+ class Migration(migrations.Migration):
12
+
13
+ dependencies = [
14
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
15
+ (
16
+ "canteen",
17
+ "0005_alter_category_created_at_alter_category_name_and_more",
18
+ ),
19
+ ]
20
+
21
+ operations = [
22
+ migrations.AddField(
23
+ model_name="category",
24
+ name="is_disabled",
25
+ field=models.BooleanField(default=False, verbose_name="已禁用"),
26
+ ),
27
+ migrations.AlterField(
28
+ model_name="category",
29
+ name="user",
30
+ field=models.ForeignKey(
31
+ on_delete=django.db.models.deletion.CASCADE,
32
+ related_name="Categories",
33
+ to=settings.AUTH_USER_MODEL,
34
+ verbose_name="大类",
35
+ ),
36
+ ),
37
+ migrations.AlterField(
38
+ model_name="consumption",
39
+ name="amount_used",
40
+ field=models.DecimalField(
41
+ decimal_places=2,
42
+ max_digits=10,
43
+ validators=[
44
+ django.core.validators.MinValueValidator(Decimal("0.0"))
45
+ ],
46
+ verbose_name="消耗数量",
47
+ ),
48
+ ),
49
+ ]
@@ -0,0 +1,30 @@
1
+ # Generated by Django 4.2.25 on 2025-10-07 07:19
2
+
3
+ import django.core.validators
4
+ from django.db import migrations, models
5
+
6
+
7
+ class Migration(migrations.Migration):
8
+
9
+ dependencies = [
10
+ ("canteen", "0006_category_is_disabled_alter_category_user_and_more"),
11
+ ]
12
+
13
+ operations = [
14
+ migrations.AlterField(
15
+ model_name="consumption",
16
+ name="amount_used",
17
+ field=models.IntegerField(
18
+ validators=[django.core.validators.MinValueValidator(0)],
19
+ verbose_name="消耗数量",
20
+ ),
21
+ ),
22
+ migrations.AlterField(
23
+ model_name="ingredient",
24
+ name="quantity",
25
+ field=models.IntegerField(
26
+ validators=[django.core.validators.MinValueValidator(0)],
27
+ verbose_name="数量",
28
+ ),
29
+ ),
30
+ ]
@@ -0,0 +1,67 @@
1
+ # Generated by Django 4.2.25 on 2025-10-08 10:12
2
+
3
+ import django.db.models.deletion
4
+ from django.conf import settings
5
+ from django.db import migrations, models
6
+
7
+
8
+ class Migration(migrations.Migration):
9
+
10
+ dependencies = [
11
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
12
+ ("canteen", "0007_alter_consumption_amount_used_and_more"),
13
+ ]
14
+
15
+ operations = [
16
+ migrations.AddField(
17
+ model_name="category",
18
+ name="abbreviation",
19
+ field=models.CharField(
20
+ blank=True,
21
+ max_length=100,
22
+ null=True,
23
+ verbose_name="abbreviation",
24
+ ),
25
+ ),
26
+ migrations.CreateModel(
27
+ name="MealType",
28
+ fields=[
29
+ (
30
+ "id",
31
+ models.BigAutoField(
32
+ auto_created=True,
33
+ primary_key=True,
34
+ serialize=False,
35
+ verbose_name="ID",
36
+ ),
37
+ ),
38
+ (
39
+ "name",
40
+ models.CharField(max_length=100, verbose_name="Me name"),
41
+ ),
42
+ (
43
+ "abbreviation",
44
+ models.CharField(
45
+ blank=True,
46
+ max_length=100,
47
+ null=True,
48
+ verbose_name="abbreviation",
49
+ ),
50
+ ),
51
+ ("created_at", models.DateField(verbose_name="创建日期")),
52
+ (
53
+ "is_disabled",
54
+ models.BooleanField(default=False, verbose_name="已禁用"),
55
+ ),
56
+ (
57
+ "user",
58
+ models.ForeignKey(
59
+ on_delete=django.db.models.deletion.CASCADE,
60
+ related_name="meal_types",
61
+ to=settings.AUTH_USER_MODEL,
62
+ verbose_name="Ingredient meal type",
63
+ ),
64
+ ),
65
+ ],
66
+ ),
67
+ ]
@@ -0,0 +1,55 @@
1
+ # Generated by Django 4.2.25 on 2025-10-08 14:59
2
+
3
+ import django.db.models.deletion
4
+ from django.conf import settings
5
+ from django.db import migrations, models
6
+
7
+
8
+ class Migration(migrations.Migration):
9
+
10
+ dependencies = [
11
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
12
+ ("canteen", "0008_category_abbreviation_mealtype"),
13
+ ]
14
+
15
+ operations = [
16
+ migrations.AlterField(
17
+ model_name="category",
18
+ name="abbreviation",
19
+ field=models.CharField(
20
+ blank=True, max_length=100, null=True, verbose_name="简称"
21
+ ),
22
+ ),
23
+ migrations.AlterField(
24
+ model_name="ingredient",
25
+ name="meal_type",
26
+ field=models.ForeignKey(
27
+ on_delete=django.db.models.deletion.PROTECT,
28
+ related_name="ingredients",
29
+ to="canteen.mealtype",
30
+ verbose_name="Meal type",
31
+ ),
32
+ ),
33
+ migrations.AlterField(
34
+ model_name="mealtype",
35
+ name="abbreviation",
36
+ field=models.CharField(
37
+ blank=True, max_length=100, null=True, verbose_name="简称"
38
+ ),
39
+ ),
40
+ migrations.AlterField(
41
+ model_name="mealtype",
42
+ name="name",
43
+ field=models.CharField(max_length=100, verbose_name="餐类名称"),
44
+ ),
45
+ migrations.AlterField(
46
+ model_name="mealtype",
47
+ name="user",
48
+ field=models.ForeignKey(
49
+ on_delete=django.db.models.deletion.CASCADE,
50
+ related_name="meal_types",
51
+ to=settings.AUTH_USER_MODEL,
52
+ verbose_name="食材餐类",
53
+ ),
54
+ ),
55
+ ]