sandwitches 2.3.1__tar.gz → 2.3.2__tar.gz

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.
Files changed (77) hide show
  1. {sandwitches-2.3.1 → sandwitches-2.3.2}/PKG-INFO +1 -1
  2. {sandwitches-2.3.1 → sandwitches-2.3.2}/pyproject.toml +1 -1
  3. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/forms.py +1 -1
  4. sandwitches-2.3.2/src/sandwitches/migrations/0010_rename_is_approved_historicalrecipe_is_community_made_and_more.py +22 -0
  5. sandwitches-2.3.2/src/sandwitches/migrations/0011_alter_historicalrecipe_is_community_made_and_more.py +25 -0
  6. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/models.py +1 -1
  7. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/admin/admin_base.html +4 -4
  8. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/admin/dashboard.html +7 -8
  9. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/admin/recipe_form.html +2 -2
  10. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/admin/recipe_list.html +1 -1
  11. sandwitches-2.3.1/src/sandwitches/templates/recipe_form.html → sandwitches-2.3.2/src/sandwitches/templates/community.html +15 -7
  12. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/components/side_menu.html +3 -3
  13. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/urls.py +1 -1
  14. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/views.py +31 -15
  15. {sandwitches-2.3.1 → sandwitches-2.3.2}/README.md +0 -0
  16. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/__init__.py +0 -0
  17. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/admin.py +0 -0
  18. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/api.py +0 -0
  19. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/asgi.py +0 -0
  20. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/feeds.py +0 -0
  21. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/locale/nl/LC_MESSAGES/django.mo +0 -0
  22. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/locale/nl/LC_MESSAGES/django.po +0 -0
  23. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/management/__init__.py +0 -0
  24. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/management/commands/__init__.py +0 -0
  25. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/management/commands/reset_daily_orders.py +0 -0
  26. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/migrations/0001_initial.py +0 -0
  27. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/migrations/0002_historicalrecipe_servings_recipe_servings.py +0 -0
  28. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/migrations/0003_setting.py +0 -0
  29. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/migrations/0004_alter_setting_ai_api_key_and_more.py +0 -0
  30. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/migrations/0005_rating_comment.py +0 -0
  31. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/migrations/0006_historicalrecipe_is_highlighted_and_more.py +0 -0
  32. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/migrations/0007_historicalrecipe_price_recipe_price_order.py +0 -0
  33. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/migrations/0008_historicalrecipe_daily_orders_count_and_more.py +0 -0
  34. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/migrations/0009_historicalrecipe_is_approved_recipe_is_approved.py +0 -0
  35. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/migrations/__init__.py +0 -0
  36. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/settings.py +0 -0
  37. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/storage.py +0 -0
  38. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/tasks.py +0 -0
  39. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/admin/confirm_delete.html +0 -0
  40. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/admin/order_list.html +0 -0
  41. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/admin/partials/dashboard_charts.html +0 -0
  42. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/admin/partials/order_rows.html +0 -0
  43. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/admin/rating_list.html +0 -0
  44. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/admin/tag_form.html +0 -0
  45. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/admin/tag_list.html +0 -0
  46. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/admin/task_detail.html +0 -0
  47. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/admin/task_list.html +0 -0
  48. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/admin/user_form.html +0 -0
  49. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/admin/user_list.html +0 -0
  50. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/base.html +0 -0
  51. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/base_beer.html +0 -0
  52. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/components/carousel_scripts.html +0 -0
  53. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/components/favorites_search_form.html +0 -0
  54. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/components/footer.html +0 -0
  55. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/components/ingredients_scripts.html +0 -0
  56. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/components/ingredients_section.html +0 -0
  57. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/components/instructions_section.html +0 -0
  58. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/components/language_dialog.html +0 -0
  59. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/components/navbar.html +0 -0
  60. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/components/rating_section.html +0 -0
  61. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/components/recipe_header.html +0 -0
  62. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/components/search_form.html +0 -0
  63. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/components/search_scripts.html +0 -0
  64. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/components/user_menu.html +0 -0
  65. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/detail.html +0 -0
  66. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/favorites.html +0 -0
  67. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/index.html +0 -0
  68. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/login.html +0 -0
  69. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/partials/recipe_list.html +0 -0
  70. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/profile.html +0 -0
  71. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/setup.html +0 -0
  72. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templates/signup.html +0 -0
  73. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templatetags/__init__.py +0 -0
  74. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templatetags/custom_filters.py +0 -0
  75. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/templatetags/markdown_extras.py +0 -0
  76. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/utils.py +0 -0
  77. {sandwitches-2.3.1 → sandwitches-2.3.2}/src/sandwitches/wsgi.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: sandwitches
3
- Version: 2.3.1
3
+ Version: 2.3.2
4
4
  Summary: Add your description here
5
5
  Author: Martyn van Dijke
6
6
  Author-email: Martyn van Dijke <martijnvdijke600@gmail.com>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "sandwitches"
3
- version = "2.3.1"
3
+ version = "2.3.2"
4
4
  description = "Add your description here"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -138,7 +138,7 @@ class RecipeForm(forms.ModelForm):
138
138
  "instructions",
139
139
  "price",
140
140
  "is_highlighted",
141
- "is_approved",
141
+ "is_community_made",
142
142
  "max_daily_orders",
143
143
  ]
144
144
  widgets = {
@@ -0,0 +1,22 @@
1
+ # Generated by Django 6.0.1 on 2026-01-24 15:32
2
+
3
+ from django.db import migrations
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+ dependencies = [
8
+ ("sandwitches", "0009_historicalrecipe_is_approved_recipe_is_approved"),
9
+ ]
10
+
11
+ operations = [
12
+ migrations.RenameField(
13
+ model_name="historicalrecipe",
14
+ old_name="is_approved",
15
+ new_name="is_community_made",
16
+ ),
17
+ migrations.RenameField(
18
+ model_name="recipe",
19
+ old_name="is_approved",
20
+ new_name="is_community_made",
21
+ ),
22
+ ]
@@ -0,0 +1,25 @@
1
+ # Generated by Django 6.0.1 on 2026-01-24 16:01
2
+
3
+ from django.db import migrations, models
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+ dependencies = [
8
+ (
9
+ "sandwitches",
10
+ "0010_rename_is_approved_historicalrecipe_is_community_made_and_more",
11
+ ),
12
+ ]
13
+
14
+ operations = [
15
+ migrations.AlterField(
16
+ model_name="historicalrecipe",
17
+ name="is_community_made",
18
+ field=models.BooleanField(default=False),
19
+ ),
20
+ migrations.AlterField(
21
+ model_name="recipe",
22
+ name="is_community_made",
23
+ field=models.BooleanField(default=False),
24
+ ),
25
+ ]
@@ -132,7 +132,7 @@ class Recipe(models.Model):
132
132
  )
133
133
  tags = models.ManyToManyField(Tag, blank=True, related_name="recipes")
134
134
  is_highlighted = models.BooleanField(default=False)
135
- is_approved = models.BooleanField(default=True)
135
+ is_community_made = models.BooleanField(default=False)
136
136
  max_daily_orders = models.PositiveIntegerField(
137
137
  null=True, blank=True, verbose_name="Max daily orders"
138
138
  )
@@ -2,15 +2,15 @@
2
2
  {% load i18n static %}
3
3
 
4
4
  {% block extra_head %}
5
- <link href="https://cdn.jsdelivr.net/npm/beercss@3.7.12/dist/cdn/beer.min.css" rel="stylesheet">
6
- <script type="module" src="https://cdn.jsdelivr.net/npm/beercss@3.7.12/dist/cdn/beer.min.js"></script>
7
- <script type="module" src="https://cdn.jsdelivr.net/npm/material-dynamic-colors@1.1.2/dist/cdn/material-dynamic-colors.min.js"></script>
8
- <script src="https://unpkg.com/htmx.org@2.0.8/dist/htmx.min.js"></script>
5
+ <link href="{% static "dist/main.css" %}" rel="stylesheet">
6
+ <script src="{% static "dist/main.js" %}" defer></script>
9
7
  <link rel="icon" type="image/svg+xml" href="{% static "icons/favicon.svg" %}">
10
8
  <style>
11
9
  main.container {
12
10
  padding-top: 2rem;
13
11
  padding-bottom: 2rem;
12
+ padding-left: 5%;
13
+ padding-right: 5%;
14
14
  }
15
15
  .admin-thumb {
16
16
  width: 80px;
@@ -1,9 +1,14 @@
1
1
  {% extends "admin/admin_base.html" %}
2
- {% load i18n %}
2
+ {% load i18n static %}
3
3
 
4
4
  {% block admin_title %}{% trans "Dashboard" %}{% endblock %}
5
5
 
6
-
6
+ {% block extra_head %}
7
+ {{ block.super }}
8
+ <link href="{% static "dist/main.css" %}" rel="stylesheet">
9
+ <link href="{% static "main.css" %}" rel="stylesheet">
10
+ <script src="{% static "dist/main.js" %}" defer></script>
11
+ {% endblock %}
7
12
 
8
13
  {% block content %}
9
14
 
@@ -318,9 +323,3 @@
318
323
  </div>
319
324
 
320
325
  {% endblock %}
321
-
322
-
323
-
324
- {% block admin_scripts %}
325
- <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
326
- {% endblock %}
@@ -82,8 +82,8 @@
82
82
 
83
83
  <div class="field middle-align mt-1">
84
84
  <label class="checkbox">
85
- {{ form.is_approved }}
86
- <span>{{ form.is_approved.label }}</span>
85
+ {{ form.is_community_made }}
86
+ <span>{{ form.is_community_made.label }}</span>
87
87
  </label>
88
88
  </div>
89
89
  </article>
@@ -88,7 +88,7 @@
88
88
  </div>
89
89
  </td>
90
90
  <td class="min center-align">
91
- {% if recipe.is_approved %}
91
+ {% if recipe.is_community_made %}
92
92
  <i class="primary-text">check_circle</i>
93
93
  {% else %}
94
94
  <a href="{% url 'admin_recipe_approve' recipe.pk %}" class="button tiny primary round" onclick="event.stopPropagation();">
@@ -1,18 +1,15 @@
1
1
  {% extends "base_beer.html" %}
2
2
  {% load i18n %}
3
3
 
4
- {% block title %}{% trans "Edit Recipe" %}{% endblock %}
4
+ {% block title %}{% trans "Community" %}{% endblock %}
5
5
 
6
6
  {% block content %}
7
+ <main class="responsive">
7
8
  <div class="large-space"></div>
8
9
  <article class="round s12 m10 l8 offset-m1 offset-l2 elevate">
9
10
  <div class="padding">
10
11
  <h4 class="center-align">
11
- {% if recipe.pk %}
12
- {% trans "Edit Recipe:" %} {{ recipe.title }}
13
- {% else %}
14
- {% trans "New Recipe" %}
15
- {% endif %}
12
+ {% trans "Submit a Recipe" %}
16
13
  </h4>
17
14
  <div class="space"></div>
18
15
 
@@ -97,16 +94,27 @@
97
94
  <a href="javascript:history.back()" class="button transparent border round">{% trans "Cancel" %}</a>
98
95
  <button type="submit" class="button primary round">
99
96
  <i class="front">save</i>
100
- <span>{% trans "Save Recipe" %}</span>
97
+ <span>{% trans "Submit Recipe" %}</span>
101
98
  </button>
102
99
  </div>
103
100
  </form>
104
101
  </div>
105
102
  </article>
103
+
104
+
105
+ <div class="large-space"></div>
106
+
107
+ <h4 class="center-align">{% trans "Community Recipes" %}</h4>
108
+ <div class="space"></div>
109
+
110
+ {% include "partials/recipe_list.html" %}
111
+
106
112
  <div class="large-space"></div>
107
113
 
108
114
  {% endblock %}
109
115
 
116
+ </main>
117
+
110
118
  {% block page_scripts %}
111
119
  <script>
112
120
  // Image Preview Logic
@@ -15,9 +15,9 @@
15
15
  <i class="extra padding">favorite</i>
16
16
  <span class="large-text">{% trans "Favorites" %}</span>
17
17
  </a>
18
- <a href="{% url 'submit_recipe' %}" class="padding {% if request.resolver_match.url_name == 'submit_recipe' %}active{% endif %}">
19
- <i class="extra padding">add_circle</i>
20
- <span class="large-text">{% trans "Submit Recipe" %}</span>
18
+ <a href="{% url 'community' %}" class="padding {% if request.resolver_match.url_name == 'community' %}active{% endif %}">
19
+ <i class="extra padding">group</i>
20
+ <span class="large-text">{% trans "Community" %}</span>
21
21
  </a>
22
22
  {% endif %}
23
23
  <a href="/api/docs" class="padding">
@@ -34,7 +34,7 @@ urlpatterns = [
34
34
  path("login/", views.CustomLoginView.as_view(), name="login"),
35
35
  path("logout/", LogoutView.as_view(next_page="index"), name="logout"),
36
36
  path("profile/", views.user_profile, name="user_profile"),
37
- path("submit-recipe/", views.submit_recipe, name="submit_recipe"),
37
+ path("community/", views.community, name="community"),
38
38
  path("admin/", admin.site.urls),
39
39
  path("api/", api.urls),
40
40
  path("media/<path:file_path>", views.media, name="media"),
@@ -36,13 +36,13 @@ User = get_user_model()
36
36
 
37
37
 
38
38
  @login_required
39
- def submit_recipe(request):
39
+ def community(request):
40
40
  if request.method == "POST":
41
41
  form = UserRecipeSubmissionForm(request.POST, request.FILES)
42
42
  if form.is_valid():
43
43
  recipe = form.save(commit=False)
44
44
  recipe.uploaded_by = request.user
45
- recipe.is_approved = False # Explicitly set to False just in case
45
+ recipe.is_community_made = True
46
46
  recipe.save()
47
47
  form.save_m2m()
48
48
  messages.success(
@@ -52,10 +52,30 @@ def submit_recipe(request):
52
52
  return redirect("user_profile")
53
53
  else:
54
54
  form = UserRecipeSubmissionForm()
55
+
56
+ # Community recipes = non-staff uploaded
57
+ recipes = Recipe.objects.filter(is_community_made=True).prefetch_related( # ty:ignore[unresolved-attribute]
58
+ "favorited_by"
59
+ )
60
+
61
+ if not request.user.is_staff:
62
+ # Regular users only see approved community recipes or their own
63
+ recipes = recipes.filter(
64
+ Q(is_community_made=True) | Q(uploaded_by=request.user)
65
+ )
66
+
67
+ recipes = recipes.order_by("-created_at")
68
+
55
69
  return render(
56
70
  request,
57
- "recipe_form.html",
58
- {"form": form, "title": _("Submit Recipe"), "version": sandwitches_version},
71
+ "community.html",
72
+ {
73
+ "form": form,
74
+ "recipes": recipes,
75
+ "title": _("Community"),
76
+ "version": sandwitches_version,
77
+ "user": request.user,
78
+ },
59
79
  )
60
80
 
61
81
 
@@ -134,8 +154,9 @@ def admin_dashboard(request):
134
154
  order_labels = [d["date"].strftime("%d/%m/%Y") for d in order_data]
135
155
  order_counts = [d["count"] for d in order_data]
136
156
 
137
- pending_recipes = Recipe.objects.filter(is_approved=False).order_by("-created_at") # ty:ignore[unresolved-attribute]
138
-
157
+ pending_recipes = Recipe.objects.filter( # ty:ignore[unresolved-attribute]
158
+ uploaded_by__is_staff=False, uploaded_by__is_superuser=False
159
+ ).order_by("-created_at")
139
160
  context = {
140
161
  "recipe_count": recipe_count,
141
162
  "user_count": user_count,
@@ -245,7 +266,7 @@ def admin_recipe_edit(request, pk):
245
266
  @staff_member_required
246
267
  def admin_recipe_approve(request, pk):
247
268
  recipe = get_object_or_404(Recipe, pk=pk)
248
- recipe.is_approved = True
269
+ recipe.is_community_made = True
249
270
  recipe.save()
250
271
  messages.success(
251
272
  request, _("Recipe '%(title)s' approved.") % {"title": recipe.title}
@@ -473,7 +494,7 @@ def admin_order_list(request):
473
494
  def recipe_detail(request, slug):
474
495
  recipe = get_object_or_404(Recipe, slug=slug)
475
496
 
476
- if not recipe.is_approved:
497
+ if not recipe.is_community_made:
477
498
  if not (
478
499
  request.user.is_authenticated
479
500
  and (request.user.is_staff or recipe.uploaded_by == request.user)
@@ -647,13 +668,8 @@ def index(request):
647
668
 
648
669
  recipes = Recipe.objects.all().prefetch_related("favorited_by") # ty:ignore[unresolved-attribute]
649
670
 
650
- if not (request.user.is_authenticated and request.user.is_staff):
651
- if request.user.is_authenticated:
652
- # Show approved recipes OR recipes uploaded by the current user
653
- recipes = recipes.filter(Q(is_approved=True) | Q(uploaded_by=request.user))
654
- else:
655
- # Show only approved recipes for anonymous users
656
- recipes = recipes.filter(is_approved=True)
671
+ # Only show "normal" recipes (uploaded by staff or no uploader)
672
+ recipes = recipes.filter(Q(is_community_made=False))
657
673
 
658
674
  # Filtering
659
675
  q = request.GET.get("q")
File without changes