diff --git a/apps/templates/_base.html b/apps/templates/_base.html index bb7a655..f346e10 100644 --- a/apps/templates/_base.html +++ b/apps/templates/_base.html @@ -29,6 +29,7 @@ {% include 'partials/_header.html' %} + {% include 'partials/_messages.html' %} {% block content %} {% endblock %} diff --git a/apps/templates/partials/_messages.html b/apps/templates/partials/_messages.html new file mode 100644 index 0000000..6e140b0 --- /dev/null +++ b/apps/templates/partials/_messages.html @@ -0,0 +1,9 @@ +
+ {% if messages %} + {% for message in messages %} + + {% endfor %} + {% endif %} +
\ No newline at end of file diff --git a/djangoreceitas/settings.py b/djangoreceitas/settings.py index e9a9a8e..0cf29b6 100644 --- a/djangoreceitas/settings.py +++ b/djangoreceitas/settings.py @@ -12,6 +12,7 @@ from pathlib import Path import os.path +from django.contrib.messages import constants as messages # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent @@ -132,3 +133,9 @@ MEDIA_ROOT = os.path.join(BASE_DIR, 'media') MEDIA_URL = '/media/' + +# Messages +MESSAGE_TAGS = { + messages.ERROR: 'danger', + messages.SUCCESS: 'success', +} \ No newline at end of file