fnschool 20251011.82005.807__py3-none-any.whl → 20251012.81520.855__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 CHANGED
@@ -6,7 +6,7 @@ import random
6
6
  import sys
7
7
  from pathlib import Path
8
8
 
9
- __version__ = "20251011.82005.807"
9
+ __version__ = "20251012.81520.855"
10
10
 
11
11
  FNSCHOOL_PATH = Path(__file__).parent
12
12
  if FNSCHOOL_PATH.as_posix() not in sys.path:
@@ -37,7 +37,7 @@ def main():
37
37
  "forget to activate a virtual environment?"
38
38
  ) from exc
39
39
 
40
- if not "runserver" in sys.argv:
40
+ if len(sys.argv) < 2:
41
41
  local_port = str(random.randint(8080, 65530))
42
42
  local_url = "http://127.0.0.1:" + local_port
43
43
  sys.argv.append("runserver")
@@ -0,0 +1,197 @@
1
+ # Generated by Django 4.2.25 on 2025-10-12 07:14
2
+
3
+ import django.core.validators
4
+ import django.db.models.deletion
5
+ import django.utils.timezone
6
+ from django.conf import settings
7
+ from django.db import migrations, models
8
+
9
+
10
+ class Migration(migrations.Migration):
11
+
12
+ dependencies = [
13
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
14
+ ("canteen", "0012_alter_ingredient_storage_date"),
15
+ ]
16
+
17
+ operations = [
18
+ migrations.AlterModelOptions(
19
+ name="consumption",
20
+ options={
21
+ "ordering": ["-date_of_using"],
22
+ "verbose_name": "消耗记录",
23
+ "verbose_name_plural": "消耗记录列表",
24
+ },
25
+ ),
26
+ migrations.AlterModelOptions(
27
+ name="ingredient",
28
+ options={
29
+ "verbose_name": "Ingredient",
30
+ "verbose_name_plural": "食材列表",
31
+ },
32
+ ),
33
+ migrations.AlterField(
34
+ model_name="category",
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="category",
42
+ name="created_at",
43
+ field=models.DateField(verbose_name="创建日期"),
44
+ ),
45
+ migrations.AlterField(
46
+ model_name="category",
47
+ name="is_disabled",
48
+ field=models.BooleanField(default=False, verbose_name="已禁用"),
49
+ ),
50
+ migrations.AlterField(
51
+ model_name="category",
52
+ name="name",
53
+ field=models.CharField(max_length=100, verbose_name="食材大类名"),
54
+ ),
55
+ migrations.AlterField(
56
+ model_name="category",
57
+ name="pin_to_consumptions_top",
58
+ field=models.BooleanField(default=False, verbose_name="置顶出库"),
59
+ ),
60
+ migrations.AlterField(
61
+ model_name="category",
62
+ name="user",
63
+ field=models.ForeignKey(
64
+ on_delete=django.db.models.deletion.CASCADE,
65
+ related_name="Categories",
66
+ to=settings.AUTH_USER_MODEL,
67
+ verbose_name="大类",
68
+ ),
69
+ ),
70
+ migrations.AlterField(
71
+ model_name="consumption",
72
+ name="date_of_using",
73
+ field=models.DateField(verbose_name="日期"),
74
+ ),
75
+ migrations.AlterField(
76
+ model_name="consumption",
77
+ name="ingredient",
78
+ field=models.ForeignKey(
79
+ on_delete=django.db.models.deletion.CASCADE,
80
+ related_name="consumptions",
81
+ to="canteen.ingredient",
82
+ verbose_name="食材",
83
+ ),
84
+ ),
85
+ migrations.AlterField(
86
+ model_name="consumption",
87
+ name="is_disabled",
88
+ field=models.BooleanField(default=False, verbose_name="已禁用"),
89
+ ),
90
+ migrations.AlterField(
91
+ model_name="ingredient",
92
+ name="category",
93
+ field=models.ForeignKey(
94
+ on_delete=django.db.models.deletion.PROTECT,
95
+ related_name="ingredients",
96
+ to="canteen.category",
97
+ verbose_name="大类",
98
+ ),
99
+ ),
100
+ migrations.AlterField(
101
+ model_name="ingredient",
102
+ name="is_disabled",
103
+ field=models.BooleanField(default=False, verbose_name="禁用"),
104
+ ),
105
+ migrations.AlterField(
106
+ model_name="ingredient",
107
+ name="is_ignorable",
108
+ field=models.BooleanField(default=False, verbose_name="不入库"),
109
+ ),
110
+ migrations.AlterField(
111
+ model_name="ingredient",
112
+ name="meal_type",
113
+ field=models.ForeignKey(
114
+ on_delete=django.db.models.deletion.PROTECT,
115
+ related_name="ingredients",
116
+ to="canteen.mealtype",
117
+ verbose_name="餐类",
118
+ ),
119
+ ),
120
+ migrations.AlterField(
121
+ model_name="ingredient",
122
+ name="name",
123
+ field=models.CharField(max_length=100, verbose_name="食材名"),
124
+ ),
125
+ migrations.AlterField(
126
+ model_name="ingredient",
127
+ name="quantity",
128
+ field=models.IntegerField(
129
+ validators=[django.core.validators.MinValueValidator(0)],
130
+ verbose_name="数量",
131
+ ),
132
+ ),
133
+ migrations.AlterField(
134
+ model_name="ingredient",
135
+ name="quantity_unit_name",
136
+ field=models.CharField(
137
+ blank=True, max_length=20, null=True, verbose_name="数量单位"
138
+ ),
139
+ ),
140
+ migrations.AlterField(
141
+ model_name="ingredient",
142
+ name="storage_date",
143
+ field=models.DateField(
144
+ default=django.utils.timezone.now, verbose_name="入库日期"
145
+ ),
146
+ preserve_default=False,
147
+ ),
148
+ migrations.AlterField(
149
+ model_name="ingredient",
150
+ name="total_price",
151
+ field=models.DecimalField(
152
+ decimal_places=2, max_digits=10, verbose_name="总价"
153
+ ),
154
+ ),
155
+ migrations.AlterField(
156
+ model_name="ingredient",
157
+ name="user",
158
+ field=models.ForeignKey(
159
+ on_delete=django.db.models.deletion.CASCADE,
160
+ related_name="ingredients",
161
+ to=settings.AUTH_USER_MODEL,
162
+ verbose_name="用户",
163
+ ),
164
+ ),
165
+ migrations.AlterField(
166
+ model_name="mealtype",
167
+ name="abbreviation",
168
+ field=models.CharField(
169
+ blank=True, max_length=100, null=True, verbose_name="简称"
170
+ ),
171
+ ),
172
+ migrations.AlterField(
173
+ model_name="mealtype",
174
+ name="created_at",
175
+ field=models.DateField(verbose_name="创建日期"),
176
+ ),
177
+ migrations.AlterField(
178
+ model_name="mealtype",
179
+ name="is_disabled",
180
+ field=models.BooleanField(default=False, verbose_name="已禁用"),
181
+ ),
182
+ migrations.AlterField(
183
+ model_name="mealtype",
184
+ name="name",
185
+ field=models.CharField(max_length=100, verbose_name="餐类名称"),
186
+ ),
187
+ migrations.AlterField(
188
+ model_name="mealtype",
189
+ name="user",
190
+ field=models.ForeignKey(
191
+ on_delete=django.db.models.deletion.CASCADE,
192
+ related_name="meal_types",
193
+ to=settings.AUTH_USER_MODEL,
194
+ verbose_name="餐类",
195
+ ),
196
+ ),
197
+ ]
fnschoo1/canteen/views.py CHANGED
@@ -421,7 +421,7 @@ def list_ingredients(request):
421
421
  if c.get("category__name") in search_query
422
422
  ]
423
423
  for category in categories:
424
- queries &= Q(category__icontains=category)
424
+ queries &= Q(category__name__icontains=category)
425
425
  search_query = search_query.replace(category, "")
426
426
 
427
427
  meal_types = Ingredient.objects.values("meal_type__name").distinct()
@@ -431,7 +431,7 @@ def list_ingredients(request):
431
431
  if m.get("meal_type__name") in search_query
432
432
  ]
433
433
  for meal_type in meal_types:
434
- queries &= Q(meal_type__icontains=meal_type)
434
+ queries &= Q(meal_type__name__icontains=meal_type)
435
435
  search_query = search_query.replace(meal_type, "")
436
436
 
437
437
  names = re.split(r"\s+", search_query)
@@ -1603,7 +1603,17 @@ class CanteenWorkBook:
1603
1603
  ]
1604
1604
  month_days.append(self.date_end)
1605
1605
 
1606
- sundays = [d for d in month_days if d.weekday() == 6]
1606
+ min_storage_date = min(
1607
+ [
1608
+ i.storage_date
1609
+ for i in ingredients
1610
+ if i.storage_date >= self.date_start
1611
+ ]
1612
+ )
1613
+ print("min_storage_date", min_storage_date)
1614
+ sundays = [
1615
+ d for d in month_days if d.weekday() == 6 and d >= min_storage_date
1616
+ ]
1607
1617
 
1608
1618
  formed_ingredients = []
1609
1619
  for sunday in sundays:
@@ -1628,6 +1638,11 @@ class CanteenWorkBook:
1628
1638
  fake_ingredients_len = (
1629
1639
  ingredient_rows_count - surplus_ingredients_len
1630
1640
  )
1641
+
1642
+ sunday_ingredients = sorted(
1643
+ sunday_ingredients, key=lambda i: i.category.name
1644
+ )
1645
+
1631
1646
  s_ingredient0 = sunday_ingredients[0]
1632
1647
  sunday_ingredients += [
1633
1648
  Ingredient(
@@ -1644,10 +1659,6 @@ class CanteenWorkBook:
1644
1659
  )
1645
1660
  for i in range(fake_ingredients_len)
1646
1661
  ]
1647
-
1648
- sunday_ingredients = sorted(
1649
- sunday_ingredients, key=lambda i: i.category.name
1650
- )
1651
1662
  for index in range(
1652
1663
  0, len(sunday_ingredients), ingredient_rows_count
1653
1664
  ):
@@ -1776,12 +1787,21 @@ class CanteenWorkBook:
1776
1787
  )
1777
1788
  summary_total_price += ingredient_total_price
1778
1789
 
1779
- sheet.cell(ingredient_row_num, 1, ingredient.name)
1790
+ ingredient_name_cell = sheet.cell(ingredient_row_num, 1)
1791
+ ingredient_name_cell.value = ingredient.name
1792
+ if ingredient.name:
1793
+ ingredient_name_cell.comment = Comment(
1794
+ _("{meal_type} ({category})").format(
1795
+ meal_type=ingredient.meal_type,
1796
+ category=ingredient.category,
1797
+ ),
1798
+ user.username,
1799
+ )
1780
1800
  sheet.cell(ingredient_row_num, 2, ingredient.quantity_unit_name)
1781
- sheet.cell(ingredient_row_num, 3, ingredient_quantity)
1782
- sheet.cell(ingredient_row_num, 4, ingredient_total_price)
1783
- sheet.cell(ingredient_row_num, 5, ingredient_quantity)
1784
- sheet.cell(ingredient_row_num, 6, ingredient_total_price)
1801
+ sheet.cell(ingredient_row_num, 3, ingredient_quantity or "")
1802
+ sheet.cell(ingredient_row_num, 4, ingredient_total_price or "")
1803
+ sheet.cell(ingredient_row_num, 5, ingredient_quantity or "")
1804
+ sheet.cell(ingredient_row_num, 6, ingredient_total_price or "")
1785
1805
  sheet.cell(ingredient_row_num, 7, "")
1786
1806
  sheet.cell(ingredient_row_num, 8, "")
1787
1807
  sheet.cell(ingredient_row_num, 9, "")
@@ -1,6 +1,7 @@
1
1
  import re
2
2
 
3
- from django.utils.translation import gettext as _
3
+ from django.utils.translation import gettext as _
4
+
4
5
  # from django.utils.translation import gettext_lazy as _
5
6
 
6
7
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fnschool
3
- Version: 20251011.82005.807
3
+ Version: 20251012.81520.855
4
4
  Summary: Just some school related scripts, without any ambition.
5
5
  Author-email: larryw3i <larryw3i@163.com>, Larry Wei <larryw3i@126.com>, Larry W3i <larryw3i@yeah.net>
6
6
  Maintainer-email: larryw3i <larryw3i@163.com>, Larry Wei <larryw3i@126.com>
@@ -1,5 +1,4 @@
1
- fnschoo1/__init__.py,sha256=eLqO0x1gqSWrEqF8dFYMX8Sf5k2_kuT3lla69Ty4If4,1506
2
- fnschoo1/db.sqlite3,sha256=k8mhvHCeeE98o8mdCTIJqFsdbGkjUYtBn7ZrFzMdp1I,176128
1
+ fnschoo1/__init__.py,sha256=xwXIxyOF7hS1i0IG9i2eEMLCovL3BDvqApE94-E5u4E,1496
3
2
  fnschoo1/manage.py,sha256=pMv0yE2eTcNrgskSHDUdRrnY51iTm1DXg32I8mWDDqw,696
4
3
  fnschoo1/canteen/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
4
  fnschoo1/canteen/admin.py,sha256=suMo4x8I3JBxAFBVIdE-5qnqZ6JAZV0FESABHOSc-vg,63
@@ -8,7 +7,7 @@ fnschoo1/canteen/forms.py,sha256=4Y75VHpnONdN5hM8aShyr7tbQSElLa-22PQK7fDRflw,229
8
7
  fnschoo1/canteen/models.py,sha256=20r24iNJW0hmPwhY96pQLYaIgqf8kc_Tx76IqORR_LE,5219
9
8
  fnschoo1/canteen/tests.py,sha256=mrbGGRNg5jwbTJtWWa7zSKdDyeB4vmgZCRc2nk6VY-g,60
10
9
  fnschoo1/canteen/urls.py,sha256=4GtrqC9L59c8zopfjRgqhbcvA5iPnGcAUVuM6CrKWpk,2797
11
- fnschoo1/canteen/views.py,sha256=4zzDoaMNRWJ0FseZOIJFhQiDLxx6AnJUK5w6-M4o7FU,26184
10
+ fnschoo1/canteen/views.py,sha256=jQQDyH3yqNUAkzDc9w-cBuKmcYosuAev5RXK3mf0irQ,26196
12
11
  fnschoo1/canteen/migrations/0001_initial.py,sha256=IHlyfT9sNc-kRQZy7NyjgWzp4EGus405QCAUw4oNdAQ,3943
13
12
  fnschoo1/canteen/migrations/0002_ingredient_is_disabled.py,sha256=j8oGWb2b99YwsEk-uwESLA_JRITEcz6b35ekoYOUGGc,444
14
13
  fnschoo1/canteen/migrations/0003_consumption_is_disabled_alter_ingredient_is_disabled.py,sha256=9RB5SHjINgrrqtDpcVIUXEBa3C_MTcR_keXLGG_PcOs,619
@@ -21,6 +20,7 @@ fnschoo1/canteen/migrations/0009_alter_category_abbreviation_and_more.py,sha256=
21
20
  fnschoo1/canteen/migrations/0010_alter_consumption_options_alter_ingredient_options_and_more.py,sha256=tG5k-8s2KYfkFHGKxsLXShCvZsO59TFMYl675_fUFao,6997
22
21
  fnschoo1/canteen/migrations/0011_category_pin_to_consumptions_top.py,sha256=gonvx7T23KlesYUGFx-WTvkz1BLZSnq0n62qKvtWnUo,553
23
22
  fnschoo1/canteen/migrations/0012_alter_ingredient_storage_date.py,sha256=JvU9xrAbGN8uoKHQw00wq6U4CaR_6WojQo-8VwmID3I,436
23
+ fnschoo1/canteen/migrations/0013_alter_consumption_options_alter_ingredient_options_and_more.py,sha256=hKwsEJ_a1ezANJSrQoca2wEy22AZESwhqH9eonNfOm8,6735
24
24
  fnschoo1/canteen/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
25
  fnschoo1/canteen/templates/canteen/close.html,sha256=pLYeJmGaOEJKMUJdZmYzz_n--l28IRDQ4fXvetP_Vsc,200
26
26
  fnschoo1/canteen/templates/canteen/category/create.html,sha256=7Hq62BqEpamDt52_Ut7DTO74_3yEn8_CqXH4e4va6dY,593
@@ -40,8 +40,8 @@ fnschoo1/canteen/templates/canteen/meal_type/delete.html,sha256=1UmCyXD-6lbYl-IE
40
40
  fnschoo1/canteen/templates/canteen/meal_type/list.html,sha256=c5kJUE1OgpRtSrMV4wFwL_gbRSaX_XMM4Zt1JTx34_g,1907
41
41
  fnschoo1/canteen/templates/canteen/meal_type/update.html,sha256=Rfv1TamSFIKHzvUNlgnmrPmfmzrehPpuo5Hv8VF0yek,818
42
42
  fnschoo1/canteen/workbook/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
43
- fnschoo1/canteen/workbook/generate.py,sha256=o6dCRE7Ne8tSCZkdu8MIsgvt4UEuf9YiefsBBAGMVec,81958
44
- fnschoo1/fnschool/__init__.py,sha256=71nfNRSJdwE_7r6s5hkoPOyQ0iSYDNhv3CcbiSwg9fw,287
43
+ fnschoo1/canteen/workbook/generate.py,sha256=347Wg5WB90dLoQb5ZkMlCo4aV0L59FsWmKoE6BptGDg,82705
44
+ fnschoo1/fnschool/__init__.py,sha256=TmHhzykpKNMoMf6eD-EKvbvmnlzs1XGHtvD55ae1sXs,287
45
45
  fnschoo1/fnschool/asgi.py,sha256=kzkqosS10uBlyBX53EXcsATcvEZmac6nsPzyOHCuucE,393
46
46
  fnschoo1/fnschool/settings.py,sha256=l9Y1iQCivSfmsNfnHltfXLzxP6gG4VMIL4GEZgAp8YM,4357
47
47
  fnschoo1/fnschool/urls.py,sha256=8WPemtCUuStd0R9gDP70c-NRQ5k7G4ksq6dYGH6xCDM,1036
@@ -93,9 +93,9 @@ fnschoo1/templates/includes/_navigation.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRk
93
93
  fnschoo1/templates/includes/_paginator.html,sha256=Z-Hxcdmun4SJ1YcHnWTDLfW8wrngROiBTwr4NZWaPP4,1246
94
94
  fnschoo1/templates/registration/logged_out.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
95
95
  fnschoo1/templates/registration/login.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
96
- fnschool-20251011.82005.807.dist-info/licenses/LICENSE,sha256=2n6rt7r999OuXp8iOqW9we7ORaxWncIbOwN1ILRGR2g,7651
97
- fnschool-20251011.82005.807.dist-info/METADATA,sha256=2cW6dqYnTCBW73v2-Ca5icWqIlEetTKnQPmYS1AbPYg,4752
98
- fnschool-20251011.82005.807.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
99
- fnschool-20251011.82005.807.dist-info/entry_points.txt,sha256=To2PDA9r0qhE0Wq1-M8hEE8uXxTrTe16BOcpKPT-q5g,47
100
- fnschool-20251011.82005.807.dist-info/top_level.txt,sha256=s6ZKnNm94Q0-247a50eI7jDK98uPF6P2kC9Ovd3LUlM,9
101
- fnschool-20251011.82005.807.dist-info/RECORD,,
96
+ fnschool-20251012.81520.855.dist-info/licenses/LICENSE,sha256=2n6rt7r999OuXp8iOqW9we7ORaxWncIbOwN1ILRGR2g,7651
97
+ fnschool-20251012.81520.855.dist-info/METADATA,sha256=6ydEZqJHWItXNsyJlhkQ4DaYb4pQghd3-Cnl2_HOXUM,4752
98
+ fnschool-20251012.81520.855.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
99
+ fnschool-20251012.81520.855.dist-info/entry_points.txt,sha256=To2PDA9r0qhE0Wq1-M8hEE8uXxTrTe16BOcpKPT-q5g,47
100
+ fnschool-20251012.81520.855.dist-info/top_level.txt,sha256=s6ZKnNm94Q0-247a50eI7jDK98uPF6P2kC9Ovd3LUlM,9
101
+ fnschool-20251012.81520.855.dist-info/RECORD,,
fnschoo1/db.sqlite3 DELETED
Binary file