diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 3e2f1348..b341ae4c 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -2,14 +2,11 @@
-
-
-
-
-
-
+
+
+
@@ -43,20 +40,44 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
+
+
-
+
@@ -65,18 +86,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -118,19 +129,20 @@
-
-
-
+
+
+
+
@@ -214,7 +226,7 @@
-
+
@@ -283,15 +295,15 @@
-
-
+
+
-
+
@@ -317,18 +329,11 @@
-
+
-
-
-
-
-
-
-
@@ -403,7 +408,9 @@
-
+
+
+
@@ -474,7 +481,6 @@
-
@@ -492,14 +498,6 @@
-
-
-
-
-
-
-
-
@@ -521,13 +519,6 @@
-
-
-
-
-
-
-
@@ -552,14 +543,6 @@
-
-
-
-
-
-
-
-
@@ -568,31 +551,75 @@
-
+
-
-
-
-
-
+
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Recipies/settings.py b/Recipies/settings.py
index fd6e4dec..cf1e5a19 100644
--- a/Recipies/settings.py
+++ b/Recipies/settings.py
@@ -38,6 +38,7 @@ INSTALLED_APPS = [
'django_tables2',
'django_filters',
'crispy_forms',
+ 'rest_framework',
'cookbook.apps.CookbookConfig',
]
diff --git a/cookbook/api.py b/cookbook/api.py
new file mode 100644
index 00000000..1b405aef
--- /dev/null
+++ b/cookbook/api.py
@@ -0,0 +1,25 @@
+import requests
+import json
+from .models import Recipe
+from django.conf import settings
+from rest_framework.decorators import api_view
+from rest_framework.response import Response
+
+
+@api_view(['GET'])
+def get_file_link(request, recipe_id):
+ recipe = Recipe.objects.get(id=recipe_id)
+
+ url = "https://api.dropboxapi.com/2/sharing/create_shared_link"
+
+ headers = {
+ "Authorization": "Bearer " + settings.DROPBOX_API_KEY,
+ "Content-Type": "application/json"
+ }
+
+ data = {
+ "path": ""
+ }
+
+ r = requests.post(url, headers=headers, data=json.dumps(data))
+ return Response(r.content)
diff --git a/cookbook/urls.py b/cookbook/urls.py
index 0efe9bc7..ca3a4798 100644
--- a/cookbook/urls.py
+++ b/cookbook/urls.py
@@ -1,6 +1,6 @@
from django.urls import path
-from . import views
+from . import views,api
urlpatterns = [
path('', views.index, name='index'),
@@ -10,4 +10,5 @@ urlpatterns = [
path('edit_recipe//', views.edit_recipe, name='edit_recipe'),
path('edit_category//', views.edit_category, name='edit_category'),
path('edit_keyword//', views.new_keyword, name='edit_keyword'),
+ path('api/get_file_link//', api.get_file_link, name='get_file_link'),
]
diff --git a/requirements.txt b/requirements.txt
index 6e6dd189..ac1785f1 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,4 +1,6 @@
+requests
django
django-tables2
django-filter
-django-crispy-forms
\ No newline at end of file
+django-crispy-forms
+djangorestframework
\ No newline at end of file