mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 04:10:06 -05:00
Merge branch 'develop' into feature/meal-planning
# Conflicts: # requirements.txt
This commit is contained in:
BIN
cookbook/locale/nl/LC_MESSAGES/django.mo
Normal file
BIN
cookbook/locale/nl/LC_MESSAGES/django.mo
Normal file
Binary file not shown.
1160
cookbook/locale/nl/LC_MESSAGES/django.po
Normal file
1160
cookbook/locale/nl/LC_MESSAGES/django.po
Normal file
File diff suppressed because it is too large
Load Diff
1
cookbook/static/js/bootstrap.min.js.map
Normal file
1
cookbook/static/js/bootstrap.min.js.map
Normal file
File diff suppressed because one or more lines are too long
9
cookbook/static/js/popper.min.js
vendored
9
cookbook/static/js/popper.min.js
vendored
File diff suppressed because one or more lines are too long
1
cookbook/static/js/popper.min.js.map
Normal file
1
cookbook/static/js/popper.min.js.map
Normal file
File diff suppressed because one or more lines are too long
@@ -118,7 +118,7 @@
|
||||
|
||||
<ul class="navbar-nav ml-auto">
|
||||
{% if user.is_authenticated %}
|
||||
<li class="nav-item dropdown {% if request.resolver_match.url_name in 'view_settings,view_history' %}active{% endif %}">
|
||||
<li class="nav-item dropdown {% if request.resolver_match.url_name in 'view_settings,view_history,view_system,docs_markdown' %}active{% endif %}">
|
||||
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="dropdown"
|
||||
aria-haspopup="true" aria-expanded="false"><i
|
||||
class="fas fa-user-alt"></i> {{ user.get_user_name }}
|
||||
@@ -130,6 +130,9 @@
|
||||
<a class="dropdown-item" href="{% url 'view_history' %}"><i
|
||||
class="fas fa-history"></i> {% trans 'History' %}</a>
|
||||
{% if user.is_superuser %}
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="{% url 'view_system' %}"><i
|
||||
class="fas fa-server fa-fw"></i> {% trans 'System' %}</a>
|
||||
<a class="dropdown-item" href="{% url 'admin:index' %}"><i
|
||||
class="fas fa-user-shield fa-fw"></i> {% trans 'Admin' %}</a>
|
||||
{% endif %}
|
||||
|
||||
66
cookbook/templates/system.html
Normal file
66
cookbook/templates/system.html
Normal file
@@ -0,0 +1,66 @@
|
||||
{% extends "base.html" %}
|
||||
{% load static %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block title %}{% trans "Cookbook Setup" %}{% endblock %}
|
||||
|
||||
{% block extra_head %}
|
||||
{{ form.media }}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h1>{% trans 'System Information' %}</h1>
|
||||
|
||||
{% blocktrans %}
|
||||
Django Recipes is an open source free software application. It can be found on <a href="https://github.com/vabene1111/recipes">GitHub</a>.
|
||||
Changelogs can be found <a href="https://github.com/vabene1111/recipes/releases">here</a>.
|
||||
{% endblocktrans %}
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
<h4>{% trans 'Media Serving' %} <span class="badge badge-{% if gunicorn_media %}danger{% else %}success{% endif %}">{% if gunicorn_media %}
|
||||
{% trans 'Warning' %}{% else %}{% trans 'Ok' %}{% endif %}</span></h4>
|
||||
{% if gunicorn_media %}
|
||||
{% blocktrans %}Serving media files directly using gunicorn/python is <b>not recommend</b>!
|
||||
Please follow the steps described
|
||||
<a href="https://github.com/vabene1111/recipes/releases/tag/0.8.1">here</a> to update
|
||||
your installation.
|
||||
{% endblocktrans %}
|
||||
{% else %}
|
||||
{% trans 'Everything is fine!' %}
|
||||
{% endif %}
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<h4>{% trans 'Debug Mode' %} <span
|
||||
class="badge badge-{% if debug %}danger{% else %}success{% endif %}">{% if debug %}
|
||||
{% trans 'Warning' %}{% else %}{% trans 'Ok' %}{% endif %}</span></h4>
|
||||
{% if debug %}
|
||||
{% blocktrans %}
|
||||
This application is still running in debug mode. This is most likely not needed. Turn of debug mode by
|
||||
setting
|
||||
<code>DEBUG=0</code> int the <code>.env</code> configuration file.
|
||||
{% endblocktrans %}
|
||||
{% else %}
|
||||
{% trans 'Everything is fine!' %}
|
||||
{% endif %}
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<h4>{% trans 'Database' %} <span
|
||||
class="badge badge-{% if postgres %}warning{% else %}success{% endif %}">{% if postgres %}
|
||||
{% trans 'Info' %}{% else %}{% trans 'Ok' %}{% endif %}</span></h4>
|
||||
{% if postgres %}
|
||||
{% blocktrans %}
|
||||
This application is not running with a Postgres database backend. This is ok but not recommended as some
|
||||
features only work with postgres databases.
|
||||
{% endblocktrans %}
|
||||
{% else %}
|
||||
{% trans 'Everything is fine!' %}
|
||||
{% endif %}
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
{% endblock %}
|
||||
@@ -14,6 +14,7 @@ router.register(r'meal-type', api.MealTypeViewSet)
|
||||
urlpatterns = [
|
||||
path('', views.index, name='index'),
|
||||
path('setup/', views.setup, name='view_setup'),
|
||||
path('system/', views.system, name='view_system'),
|
||||
path('search/', views.search, name='view_search'),
|
||||
path('books/', views.books, name='view_books'),
|
||||
path('plan/', views.meal_plan, name='view_plan'),
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import os
|
||||
import uuid
|
||||
from io import BytesIO
|
||||
|
||||
import simplejson
|
||||
@@ -71,7 +72,7 @@ def internal_recipe_update(request, pk):
|
||||
|
||||
im_io = BytesIO()
|
||||
img.save(im_io, 'PNG', quality=70)
|
||||
recipe.image = File(im_io, name=(str(recipe.pk) + '.png'))
|
||||
recipe.image = File(im_io, name=f'{uuid.uuid4()}_{recipe.pk}.png')
|
||||
elif 'image' in form.changed_data and form.cleaned_data['image'] is False:
|
||||
recipe.image = None
|
||||
|
||||
|
||||
@@ -23,6 +23,8 @@ from cookbook.tables import RecipeTable, RecipeTableSmall, CookLogTable, ViewLog
|
||||
|
||||
def index(request):
|
||||
if not request.user.is_authenticated:
|
||||
if User.objects.count() < 1 and 'django.contrib.auth.backends.RemoteUserBackend' not in settings.AUTHENTICATION_BACKENDS:
|
||||
return HttpResponseRedirect(reverse_lazy('view_setup'))
|
||||
return HttpResponseRedirect(reverse_lazy('view_search'))
|
||||
try:
|
||||
page_map = {
|
||||
@@ -262,6 +264,12 @@ def history(request):
|
||||
return render(request, 'history.html', {'view_log': view_log, 'cook_log': cook_log})
|
||||
|
||||
|
||||
@group_required('admin')
|
||||
def system(request):
|
||||
postgres = False if settings.DATABASES['default']['ENGINE'] == 'django.db.backends.postgresql_psycopg2' else True
|
||||
return render(request, 'system.html', {'gunicorn_media': settings.GUNICORN_MEDIA, 'debug': settings.DEBUG, 'postgres': postgres})
|
||||
|
||||
|
||||
def setup(request):
|
||||
if User.objects.count() > 0 or 'django.contrib.auth.backends.RemoteUserBackend' in settings.AUTHENTICATION_BACKENDS:
|
||||
messages.add_message(request, messages.ERROR, _('The setup page can only be used to create the first user! If you have forgotten your superuser credentials please consult the django documentation on how to reset passwords.'))
|
||||
|
||||
Reference in New Issue
Block a user