diff --git a/.env.template b/.env.template
index d31cb01b3..9ae5d9756 100644
--- a/.env.template
+++ b/.env.template
@@ -1,4 +1,5 @@
# only set this to true when testing/debugging
+# when unset: 1 (true) - dont unset this, just for development
DEBUG=0
# hosts the application can run under e.g. recipes.mydomain.com,cooking.mydomain.com,...
@@ -18,9 +19,17 @@ POSTGRES_DB=djangodb
# Serve mediafiles directly using gunicorn. Basically everyone recommends not doing this. Please use any of the examples
# provided that include an additional nxginx container to handle media file serving.
# If you know what you are doing turn this back on (1) to serve media files using djangos serve() method.
+# when unset: 1 (true) - this is temporary until an appropriate amount of time has passed for everyone to migrate
GUNICORN_MEDIA=0
# allow authentication via reverse proxy (e.g. authelia), leave of if you dont know what you are doing
# docs: https://github.com/vabene1111/recipes/tree/develop/docs/docker/nginx-proxy%20with%20proxy%20authentication
+# when unset: 0 (false)
REVERSE_PROXY_AUTH=0
+
+
+# the default value for the user preference 'comments' (enable/disable commenting system)
+# when unset: 1 (true)
+COMMENT_PREF_DEFAULT=1
+
diff --git a/cookbook/forms.py b/cookbook/forms.py
index 6571ae101..338f2b905 100644
--- a/cookbook/forms.py
+++ b/cookbook/forms.py
@@ -31,14 +31,15 @@ class UserPreferenceForm(forms.ModelForm):
class Meta:
model = UserPreference
- fields = ('default_unit', 'theme', 'nav_color', 'default_page', 'show_recent', 'search_style', 'plan_share', 'ingredient_decimals')
+ fields = ('default_unit', 'theme', 'nav_color', 'default_page', 'show_recent', 'search_style', 'plan_share', 'ingredient_decimals', 'comments')
help_texts = {
'nav_color': _('Color of the top navigation bar. Not all colors work with all themes, just try them out!'),
'default_unit': _('Default Unit to be used when inserting a new ingredient into a recipe.'),
'plan_share': _('Default user to share newly created meal plan entries with.'),
'show_recent': _('Show recently viewed recipes on search page.'),
- 'ingredient_decimals': _('Number of decimals to round ingredients.')
+ 'ingredient_decimals': _('Number of decimals to round ingredients.'),
+ 'comments': _('If you want to be able to create and see comments underneath recipes.')
}
widgets = {
diff --git a/cookbook/migrations/0055_auto_20200616_1236.py b/cookbook/migrations/0055_auto_20200616_1236.py
new file mode 100644
index 000000000..e4c8847b9
--- /dev/null
+++ b/cookbook/migrations/0055_auto_20200616_1236.py
@@ -0,0 +1,24 @@
+# Generated by Django 3.0.7 on 2020-06-16 10:36
+
+from django.db import migrations, models
+import uuid
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('cookbook', '0054_sharelink'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='userpreference',
+ name='comments',
+ field=models.BooleanField(default=True),
+ ),
+ migrations.AlterField(
+ model_name='sharelink',
+ name='uuid',
+ field=models.UUIDField(default=uuid.UUID('a6e8f192-cc03-4dd4-8a03-58d7ab6b7df7')),
+ ),
+ ]
diff --git a/cookbook/models.py b/cookbook/models.py
index e88f465b1..b557f23d8 100644
--- a/cookbook/models.py
+++ b/cookbook/models.py
@@ -6,6 +6,8 @@ from django.contrib.auth.models import User
from django.utils.translation import gettext as _
from django.db import models
+from recipes.settings import COMMENT_PREF_DEFAULT
+
def get_user_name(self):
if not (name := f"{self.first_name} {self.last_name}") == " ":
@@ -64,6 +66,7 @@ class UserPreference(models.Model):
show_recent = models.BooleanField(default=True)
plan_share = models.ManyToManyField(User, blank=True, related_name='plan_share_default')
ingredient_decimals = models.IntegerField(default=2)
+ comments = models.BooleanField(default=COMMENT_PREF_DEFAULT)
def __str__(self):
return str(self.user)
diff --git a/cookbook/templates/recipe_view.html b/cookbook/templates/recipe_view.html
index e1945d507..5e2c422fa 100644
--- a/cookbook/templates/recipe_view.html
+++ b/cookbook/templates/recipe_view.html
@@ -268,36 +268,39 @@
{% endif %}
-
-
-
-