From 68b8c6fa9d4abe33a70e6653d7e515a4a122198d Mon Sep 17 00:00:00 2001 From: mohammad133 Date: Wed, 19 May 2021 12:47:13 +0430 Subject: [PATCH 1/4] add .venv to .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 2b00f1b..27e2c5e 100644 --- a/.gitignore +++ b/.gitignore @@ -90,3 +90,5 @@ ENV/ # SQLite3 db.sqlite3 + +.venv From 9439b0c771415716147e9858e9011e76244610e3 Mon Sep 17 00:00:00 2001 From: mohammad133 Date: Wed, 19 May 2021 14:48:55 +0430 Subject: [PATCH 2/4] django updated --- requirements.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/requirements.txt b/requirements.txt index 6eb9d54..8a75b85 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ -Django==1.10.5 -django-cors-middleware==1.3.1 -django-extensions==1.7.1 -djangorestframework==3.4.4 -PyJWT==1.4.2 -six==1.10.0 +Django +django-cors-middleware +django-extensions +djangorestframework +PyJWT +six From d2ec66baa7c8ff2b75ba09a3c8972b1ec486ad3a Mon Sep 17 00:00:00 2001 From: mohammad133 Date: Wed, 19 May 2021 14:49:11 +0430 Subject: [PATCH 3/4] django updated2 --- conduit/urls.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/conduit/urls.py b/conduit/urls.py index 54612f9..3653304 100644 --- a/conduit/urls.py +++ b/conduit/urls.py @@ -19,7 +19,7 @@ urlpatterns = [ url(r'^admin/', admin.site.urls), - url(r'^api/', include('conduit.apps.articles.urls', namespace='articles')), - url(r'^api/', include('conduit.apps.authentication.urls', namespace='authentication')), - url(r'^api/', include('conduit.apps.profiles.urls', namespace='profiles')), -] + url(r'^api/', include(('conduit.apps.articles.urls','conduit.apps.articles') ,namespace='articles')), + url(r'^api/', include(('conduit.apps.authentication.urls','conduit.apps.authentication'), namespace='authentication')), + url(r'^api/', include(('conduit.apps.profiles.urls','conduit.apps.profiles'), namespace='profiles')), +] \ No newline at end of file From f5ba8e396fdcdf08bc29ed521fb4c7727edb8e47 Mon Sep 17 00:00:00 2001 From: mohammad133 Date: Wed, 19 May 2021 17:41:52 +0430 Subject: [PATCH 4/4] update --- conduit/apps/articles/admin.py | 24 ++++++++++++++++++++++++ conduit/apps/articles/serializers.py | 2 +- conduit/apps/profiles/serializers.py | 2 +- requirements.txt | 12 ++++++------ 4 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 conduit/apps/articles/admin.py diff --git a/conduit/apps/articles/admin.py b/conduit/apps/articles/admin.py new file mode 100644 index 0000000..ee99c74 --- /dev/null +++ b/conduit/apps/articles/admin.py @@ -0,0 +1,24 @@ +from django.contrib import admin +from .models import * + + +class ArticleAdmin(admin.ModelAdmin): + list_display = ['slug', 'title', 'description'] + + +admin.site.register(Article, ArticleAdmin) + + +class CommentAdmin(admin.ModelAdmin): + search_fields = ['author', 'body'] + list_display = ['author', 'body'] + + +admin.site.register(Comment, CommentAdmin) + + +class TagAdmin(admin.ModelAdmin): + list_display = ['tag', 'slug'] + + +admin.site.register(Tag, TagAdmin) \ No newline at end of file diff --git a/conduit/apps/articles/serializers.py b/conduit/apps/articles/serializers.py index 167909b..a61ed67 100644 --- a/conduit/apps/articles/serializers.py +++ b/conduit/apps/articles/serializers.py @@ -62,7 +62,7 @@ def get_favorited(self, instance): if request is None: return False - if not request.user.is_authenticated(): + if not request.user.is_authenticated: return False return request.user.profile.has_favorited(instance) diff --git a/conduit/apps/profiles/serializers.py b/conduit/apps/profiles/serializers.py index b799082..4d2ee8c 100644 --- a/conduit/apps/profiles/serializers.py +++ b/conduit/apps/profiles/serializers.py @@ -26,7 +26,7 @@ def get_following(self, instance): if request is None: return False - if not request.user.is_authenticated(): + if not request.user.is_authenticated: return False follower = request.user.profile diff --git a/requirements.txt b/requirements.txt index 8a75b85..89adc0e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ -Django -django-cors-middleware -django-extensions -djangorestframework -PyJWT -six +Django==3.3.4 +django-cors-middleware==3.3.4 +django-extensions==3.3.4 +djangorestframework==3.3.4 +PyJWT==3.3.4 +six==3.3.4