diff --git a/cookbook/helper/dropbox.py b/cookbook/helper/dropbox.py
index df68b1d5f..64edebf4a 100644
--- a/cookbook/helper/dropbox.py
+++ b/cookbook/helper/dropbox.py
@@ -1,4 +1,6 @@
import os
+from datetime import datetime
+
import requests
import json
from django.conf import settings
@@ -44,6 +46,10 @@ def import_all(monitor):
log_entry = ImportLog(status='SUCCESS', msg='Imported ' + str(import_count) + ' recipes', monitor=monitor)
log_entry.save()
+
+ monitor.last_checked = datetime.now()
+ monitor.save()
+
return True
diff --git a/cookbook/tables.py b/cookbook/tables.py
index 105eb439f..1ffb45249 100644
--- a/cookbook/tables.py
+++ b/cookbook/tables.py
@@ -39,9 +39,18 @@ class KeywordTable(tables.Table):
class MonitoredPathTable(tables.Table):
- edit = tables.TemplateColumn("" + _('Delete') + "")
+ delete = tables.TemplateColumn("" + _('Delete') + "")
class Meta:
model = Keyword
template_name = 'generic/table_template.html'
fields = ('path', 'last_checked')
+
+
+class NewRecipeTable(tables.Table):
+ delete = tables.TemplateColumn("" + _('Delete') + "")
+
+ class Meta:
+ model = Keyword
+ template_name = 'generic/table_template.html'
+ fields = ('name','path')
diff --git a/cookbook/templates/base.html b/cookbook/templates/base.html
index 073fcaa3e..d548a6d9c 100644
--- a/cookbook/templates/base.html
+++ b/cookbook/templates/base.html
@@ -51,7 +51,8 @@
{% trans 'Manage Data' %}
diff --git a/cookbook/templates/batch/import.html b/cookbook/templates/batch/import.html
index 131ca6966..df0ddde37 100644
--- a/cookbook/templates/batch/import.html
+++ b/cookbook/templates/batch/import.html
@@ -1,21 +1,16 @@
{% extends "base.html" %}
-{% load crispy_forms_tags %}
{% load i18n %}
{% load django_tables2 %}
-{% block title %}{% trans 'Import Recipes' %}{% endblock %}
+{% block title %}{% trans 'Imported Recipes' %}{% endblock %}
{% block content %}
-
- {% trans 'Import Recipes' %}
- {% trans 'Manage all paths that should be imported' %}
-
+ {% trans 'Update imported Recipes' %}
+
+
+
-
-
- {% render_table monitored_paths %}
+ {% render_table imported_recipes %}
{% endblock %}
\ No newline at end of file
diff --git a/cookbook/templates/batch/monitor.html b/cookbook/templates/batch/monitor.html
new file mode 100644
index 000000000..dd5f6acb6
--- /dev/null
+++ b/cookbook/templates/batch/monitor.html
@@ -0,0 +1,21 @@
+{% extends "base.html" %}
+{% load crispy_forms_tags %}
+{% load i18n %}
+{% load django_tables2 %}
+
+{% block title %}{% trans 'Sync' %}{% endblock %}
+
+{% block content %}
+
+ {% trans 'Manage watched Folders' %}
+
+ {% trans 'On this Page you can manage all DropBox folder locations that should be monitored and synced' %}
+ {% trans 'The path must be in the following format' %} /Folder/RecipesFolder
+
+
+
+ {% render_table monitored_paths %}
+
+{% endblock %}
\ No newline at end of file
diff --git a/cookbook/urls.py b/cookbook/urls.py
index 71670d5ce..422fd7d7b 100644
--- a/cookbook/urls.py
+++ b/cookbook/urls.py
@@ -20,7 +20,9 @@ urlpatterns = [
path('delete/keyword//', edit.KeywordDelete.as_view(), name='delete_keyword'),
path('delete/category//', edit.CategoryDelete.as_view(), name='delete_category'),
path('delete/monitor//', edit.MonitorDelete.as_view(), name='delete_monitor'),
+ path('delete/new_recipe//', edit.NewRecipeDelete.as_view(), name='delete_new_recipe'),
+ path('batch/monitor', batch.batch_monitor, name='batch_monitor'),
path('batch/import', batch.batch_import, name='batch_import'),
path('batch/category', batch.batch_edit, name='batch_edit'),
diff --git a/cookbook/views/api.py b/cookbook/views/api.py
index 3cff7cea5..24d8097e0 100644
--- a/cookbook/views/api.py
+++ b/cookbook/views/api.py
@@ -20,4 +20,4 @@ def get_file_link(request, recipe_id):
@login_required
def dropbox_sync(request):
dropbox.sync_all()
- return HttpResponse("Import Successful")
+ return HttpResponse("Import Successful ... or not ? WIP")
diff --git a/cookbook/views/batch.py b/cookbook/views/batch.py
index bdf54cd5d..e489550bb 100644
--- a/cookbook/views/batch.py
+++ b/cookbook/views/batch.py
@@ -4,14 +4,13 @@ from django.contrib.auth.decorators import login_required
from django.shortcuts import redirect, render
from django_tables2 import RequestConfig
-from cookbook.forms import ImportForm, BatchEditForm
-from cookbook.helper import dropbox
+from cookbook.forms import ImportForm, BatchEditForm, NewRecipe
from cookbook.models import Recipe, Category, Monitor
-from cookbook.tables import MonitoredPathTable
+from cookbook.tables import MonitoredPathTable, NewRecipeTable
@login_required
-def batch_import(request):
+def batch_monitor(request):
if request.method == "POST":
form = ImportForm(request.POST)
if form.is_valid():
@@ -26,7 +25,15 @@ def batch_import(request):
monitored_paths = MonitoredPathTable(Monitor.objects.all())
RequestConfig(request, paginate={'per_page': 25}).configure(monitored_paths)
- return render(request, 'batch/import.html', {'form': form, 'monitored_paths': monitored_paths})
+ return render(request, 'batch/monitor.html', {'form': form, 'monitored_paths': monitored_paths})
+
+
+@login_required
+def batch_import(request):
+ imported_recipes = NewRecipeTable(NewRecipe.objects.all())
+ RequestConfig(request, paginate={'per_page': 25}).configure(imported_recipes)
+
+ return render(request, 'batch/import.html', {'imported_recipes': imported_recipes})
@login_required
diff --git a/cookbook/views/edit.py b/cookbook/views/edit.py
index 789f77966..326e81b40 100644
--- a/cookbook/views/edit.py
+++ b/cookbook/views/edit.py
@@ -7,7 +7,7 @@ from django.utils.translation import gettext as _
from django.views.generic import UpdateView, DeleteView
from cookbook.forms import EditRecipeForm
-from cookbook.models import Recipe, Category, Monitor, Keyword
+from cookbook.models import Recipe, Category, Monitor, Keyword, NewRecipe
class MonitorUpdate(LoginRequiredMixin, UpdateView):
@@ -67,3 +67,9 @@ class KeywordDelete(LoginRequiredMixin, DeleteView):
template_name = "generic\delete_template.html"
model = Keyword
success_url = reverse_lazy('index')
+
+
+class NewRecipeDelete(LoginRequiredMixin, DeleteView):
+ template_name = "generic\delete_template.html"
+ model = NewRecipe
+ success_url = reverse_lazy('batch_import')