From a433b36e59e910c19c049d7ab15dce6a4b86584f Mon Sep 17 00:00:00 2001 From: Ahmed Amer Abd AL-Azeez <80992251+Droxt1@users.noreply.github.com> Date: Fri, 22 Jul 2022 04:33:06 +0300 Subject: [PATCH 01/10] Update urls.py --- config/urls.py | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/config/urls.py b/config/urls.py index d52e5777..f77bccd3 100644 --- a/config/urls.py +++ b/config/urls.py @@ -1,21 +1,11 @@ -"""config URL Configuration - -The `urlpatterns` list routes URLs to views. For more information please see: - https://docs.djangoproject.com/en/3.2/topics/http/urls/ -Examples: -Function views - 1. Add an import: from my_app import views - 2. Add a URL to urlpatterns: path('', views.home, name='home') -Class-based views - 1. Add an import: from other_app.views import Home - 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') -Including another URLconf - 1. Import the include() function: from django.urls import include, path - 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) -""" from django.contrib import admin from django.urls import path +from headless.controllers import Management_Control +from ninja import NinjaAPI +api = NinjaAPI(title='Rings are cool man', description='I insist') +api.add_router("", Management_Control) urlpatterns = [ path('admin/', admin.site.urls), + path('api/', api.urls), ] From d7323bb9169248f689e4fd5524ed56d9c4073153 Mon Sep 17 00:00:00 2001 From: Ahmed Amer Abd AL-Azeez <80992251+Droxt1@users.noreply.github.com> Date: Fri, 22 Jul 2022 04:34:05 +0300 Subject: [PATCH 02/10] Update controllers.py --- headless/controllers.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/headless/controllers.py b/headless/controllers.py index e69de29b..185ad4f9 100644 --- a/headless/controllers.py +++ b/headless/controllers.py @@ -0,0 +1,25 @@ +from urllib import request +from headless.utils import * +from ninja import Router + +Management_Control = Router() + +@Management_Control.get("/Listing_Posts") +def listing_posts(request): + return list_posts() + +@Management_Control.get("/Requesting_Post") +def calling_post(request,title: str): + return get_post(title) + +@Management_Control.post("/Creating_Post") +def make_post(request,title: str,content: str): + return save_post(title,content) + +@Management_Control.put("/Updating_Post") +def upating_post(request,title: str,content: str): + return save_post(title,content,) + +@Management_Control.delete("/Deleting_Post") +def remove_post(request,title): + return del_post(title) From aabde32d8af6c285b7be1b16660c3a658a883517 Mon Sep 17 00:00:00 2001 From: Ahmed Amer Abd AL-Azeez <80992251+Droxt1@users.noreply.github.com> Date: Fri, 22 Jul 2022 04:35:09 +0300 Subject: [PATCH 03/10] Update utils.py --- headless/utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/headless/utils.py b/headless/utils.py index 20a48f9c..6c9c436e 100644 --- a/headless/utils.py +++ b/headless/utils.py @@ -36,6 +36,7 @@ def get_post(title): except FileNotFoundError: return None - def del_post(title): - pass \ No newline at end of file + filename = f"posts/{title}.md" + if default_storage.exists(filename): + default_storage.delete(filename) From ec519fde9db0416f4f1f3afe72c71ca53a1a3a86 Mon Sep 17 00:00:00 2001 From: Ahmed Amer Abd AL-Azeez <80992251+Droxt1@users.noreply.github.com> Date: Fri, 22 Jul 2022 04:35:38 +0300 Subject: [PATCH 04/10] Update requirements.txt --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index ac5d13a7..74f306ec 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,3 +5,4 @@ pydantic==1.8.2 pytz==2021.3 sqlparse==0.4.2 typing-extensions==3.10.0.2 +utils==1.0.1 From 51432d2203be2c1ea45b116fd2be612fd331b104 Mon Sep 17 00:00:00 2001 From: Ahmed Amer Abd AL-Azeez <80992251+Droxt1@users.noreply.github.com> Date: Fri, 22 Jul 2022 04:36:45 +0300 Subject: [PATCH 05/10] Update dot_net_core_sucks_less_than_php.md --- posts/dot_net_core_sucks_less_than_php.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/posts/dot_net_core_sucks_less_than_php.md b/posts/dot_net_core_sucks_less_than_php.md index 9b8a873b..8fc974b6 100644 --- a/posts/dot_net_core_sucks_less_than_php.md +++ b/posts/dot_net_core_sucks_less_than_php.md @@ -1,7 +1,7 @@ # Main title -Because I said so +الزعفرانية محور الكون ## Secondary title -I insist \ No newline at end of file +I love Primer(Movie) From 0e9cb0dc4544d878c5b25a66e81fb26a8dedc1c4 Mon Sep 17 00:00:00 2001 From: Ahmed Amer Abd AL-Azeez <80992251+Droxt1@users.noreply.github.com> Date: Fri, 22 Jul 2022 04:37:46 +0300 Subject: [PATCH 06/10] Update php_sucks.md --- posts/php_sucks.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/posts/php_sucks.md b/posts/php_sucks.md index 56fa8623..c5b13b40 100644 --- a/posts/php_sucks.md +++ b/posts/php_sucks.md @@ -1 +1 @@ -PHP sucks because Layth said so! \ No newline at end of file +RINGS ARE COOL ASF From 1dcc5c3789e8e3ca381aa4da64f600ac4a9233de Mon Sep 17 00:00:00 2001 From: Ahmed Amer Abd AL-Azeez <80992251+Droxt1@users.noreply.github.com> Date: Fri, 22 Jul 2022 04:38:24 +0300 Subject: [PATCH 07/10] Add files via upload --- posts/DeathMetal.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 posts/DeathMetal.md diff --git a/posts/DeathMetal.md b/posts/DeathMetal.md new file mode 100644 index 00000000..b9a66cd3 --- /dev/null +++ b/posts/DeathMetal.md @@ -0,0 +1 @@ +Attitude \ No newline at end of file From 86b5e0142505fe90032ac26e3d2ebf99dcebea96 Mon Sep 17 00:00:00 2001 From: Ahmed Amer Abd AL-Azeez <80992251+Droxt1@users.noreply.github.com> Date: Fri, 22 Jul 2022 04:38:56 +0300 Subject: [PATCH 08/10] Add files via upload --- posts/test.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 posts/test.md diff --git a/posts/test.md b/posts/test.md new file mode 100644 index 00000000..ba6757f7 --- /dev/null +++ b/posts/test.md @@ -0,0 +1 @@ +do a flip \ No newline at end of file From dedf0f1ef811b289b7c134d4258ec49d73f150b5 Mon Sep 17 00:00:00 2001 From: Ahmed Amer Abd AL-Azeez <80992251+Droxt1@users.noreply.github.com> Date: Fri, 22 Jul 2022 04:40:10 +0300 Subject: [PATCH 09/10] Update and rename posts/DeathMetal.md to Metal.md --- Metal.md | 1 + posts/DeathMetal.md | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 Metal.md delete mode 100644 posts/DeathMetal.md diff --git a/Metal.md b/Metal.md new file mode 100644 index 00000000..615d6a41 --- /dev/null +++ b/Metal.md @@ -0,0 +1 @@ +Attitude by Metallica diff --git a/posts/DeathMetal.md b/posts/DeathMetal.md deleted file mode 100644 index b9a66cd3..00000000 --- a/posts/DeathMetal.md +++ /dev/null @@ -1 +0,0 @@ -Attitude \ No newline at end of file From c5ad69be73a41b8d4b2f6a367e2795874c1836ef Mon Sep 17 00:00:00 2001 From: Ahmed Amer Abd AL-Azeez <80992251+Droxt1@users.noreply.github.com> Date: Fri, 22 Jul 2022 19:14:51 +0300 Subject: [PATCH 10/10] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 74f306ec..77296dfc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,4 +5,4 @@ pydantic==1.8.2 pytz==2021.3 sqlparse==0.4.2 typing-extensions==3.10.0.2 -utils==1.0.1 +