mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 04:10:06 -05:00
updated documentation
This commit is contained in:
@@ -38,6 +38,7 @@ from cookbook.models import (CookLog, Food, Ingredient, Keyword, MealPlan,
|
||||
Storage, Sync, SyncLog, Unit, UserPreference,
|
||||
ViewLog, RecipeBookEntry)
|
||||
from cookbook.provider.dropbox import Dropbox
|
||||
from cookbook.provider.local import Local
|
||||
from cookbook.provider.nextcloud import Nextcloud
|
||||
from cookbook.serializer import (FoodSerializer, IngredientSerializer,
|
||||
KeywordSerializer, MealPlanSerializer,
|
||||
@@ -370,6 +371,8 @@ def get_recipe_provider(recipe):
|
||||
return Dropbox
|
||||
elif recipe.storage.method == Storage.NEXTCLOUD:
|
||||
return Nextcloud
|
||||
elif recipe.storage.method == Storage.LOCAL:
|
||||
return Local
|
||||
else:
|
||||
raise Exception('Provider not implemented')
|
||||
|
||||
@@ -394,8 +397,8 @@ def get_external_file_link(request, recipe_id):
|
||||
@group_required('user')
|
||||
def get_recipe_file(request, recipe_id):
|
||||
recipe = Recipe.objects.get(id=recipe_id)
|
||||
if not recipe.cors_link:
|
||||
update_recipe_links(recipe)
|
||||
# if not recipe.cors_link:
|
||||
# update_recipe_links(recipe)
|
||||
|
||||
return FileResponse(get_recipe_provider(recipe).get_file(recipe))
|
||||
|
||||
@@ -420,6 +423,10 @@ def sync_all(request):
|
||||
ret = Nextcloud.import_all(monitor)
|
||||
if not ret:
|
||||
error = True
|
||||
if monitor.storage.method == Storage.LOCAL:
|
||||
ret = Local.import_all(monitor)
|
||||
if not ret:
|
||||
error = True
|
||||
|
||||
if not error:
|
||||
messages.add_message(
|
||||
|
||||
@@ -13,6 +13,7 @@ from cookbook.models import (Comment, InviteLink, Keyword, MealPlan, Recipe,
|
||||
RecipeBook, RecipeBookEntry, RecipeImport,
|
||||
Storage, Sync)
|
||||
from cookbook.provider.dropbox import Dropbox
|
||||
from cookbook.provider.local import Local
|
||||
from cookbook.provider.nextcloud import Nextcloud
|
||||
|
||||
|
||||
@@ -37,6 +38,8 @@ def delete_recipe_source(request, pk):
|
||||
Dropbox.delete_file(recipe)
|
||||
if recipe.storage.method == Storage.NEXTCLOUD:
|
||||
Nextcloud.delete_file(recipe)
|
||||
if recipe.storage.method == Storage.LOCAL:
|
||||
Local.delete_file(recipe)
|
||||
|
||||
recipe.storage = None
|
||||
recipe.file_path = ''
|
||||
|
||||
@@ -18,6 +18,7 @@ from cookbook.models import (Comment, Food, Ingredient, Keyword, MealPlan,
|
||||
MealType, Recipe, RecipeBook, RecipeImport,
|
||||
Storage, Sync)
|
||||
from cookbook.provider.dropbox import Dropbox
|
||||
from cookbook.provider.local import Local
|
||||
from cookbook.provider.nextcloud import Nextcloud
|
||||
|
||||
|
||||
@@ -231,6 +232,8 @@ class ExternalRecipeUpdate(GroupRequiredMixin, UpdateView):
|
||||
Dropbox.rename_file(old_recipe, self.object.name)
|
||||
if self.object.storage.method == Storage.NEXTCLOUD:
|
||||
Nextcloud.rename_file(old_recipe, self.object.name)
|
||||
if self.object.storage.method == Storage.LOCAL:
|
||||
Local.rename_file(old_recipe, self.object.name)
|
||||
|
||||
self.object.file_path = "%s/%s%s" % (
|
||||
os.path.dirname(self.object.file_path),
|
||||
|
||||
Reference in New Issue
Block a user