diff --git a/django-blog/chat/__pycache__/urls.cpython-37.pyc b/django-blog/chat/__pycache__/urls.cpython-37.pyc index 8934fa1..cc57c4c 100644 Binary files a/django-blog/chat/__pycache__/urls.cpython-37.pyc and b/django-blog/chat/__pycache__/urls.cpython-37.pyc differ diff --git a/django-blog/chat/__pycache__/views.cpython-37.pyc b/django-blog/chat/__pycache__/views.cpython-37.pyc index 4956c66..7dbab56 100644 Binary files a/django-blog/chat/__pycache__/views.cpython-37.pyc and b/django-blog/chat/__pycache__/views.cpython-37.pyc differ diff --git a/django-blog/chat/templates/chat/home.html b/django-blog/chat/templates/chat/home.html index 21d3f8b..2a49e6b 100644 --- a/django-blog/chat/templates/chat/home.html +++ b/django-blog/chat/templates/chat/home.html @@ -1,19 +1,31 @@ - {% load static %} + {% load static %} + HOME PAGE 😌 - - + + + + + + + + + - - + + - HOME PAGE 😌 + @@ -22,6 +34,35 @@ + + + + + + + + + + + + {%if user.is_authenticated %} Hello {{user.username}}🐛 @@ -29,13 +70,20 @@ LogOut Create Post password reset -
+

+ + -

in this page you will see the posts.

-

Posts

+ + + + + + +

Posts

{%for post in posts %}
  • {{post.title}}
  • {%endfor%} @@ -46,10 +94,14 @@

    Posts

    style="float: right"href="{%url 'chat:auth' %}">login - - + + {%endif%} diff --git a/django-blog/chat/urls.py b/django-blog/chat/urls.py index e3730a5..0600068 100644 --- a/django-blog/chat/urls.py +++ b/django-blog/chat/urls.py @@ -30,19 +30,14 @@ path('update/',Postupdate.as_view(),name= 'postupdate'), path('delete/',Postdelete.as_view(),name = 'deletepost'), - # path('accounts/',include('django.contrib.auth.urls')), + path('accounts/',include('django.contrib.auth.urls')), # path('logout/', # auth_views.LogoutView.as_view(next_page = reverse_lazy('chat:home')),name = 'logout'), - - + path("accounts/password_change",auth_views.PasswordChangeView.as_view( success_url=reverse_lazy("chat:password_change_done") - ),name="password_change"), - - path("accounts/password_change",auth_views.PasswordChangeView.as_view( - success_url=reverse_lazy("chat:password_change_done") - ),name="password_reset"), - + ),name="password_change"), + path('notfound/',someview), path("register/",register,name="reg"), path("login/",authenticating,name="auth"), diff --git a/django-blog/chat/views.py b/django-blog/chat/views.py index 33f82b7..2c3a2ae 100644 --- a/django-blog/chat/views.py +++ b/django-blog/chat/views.py @@ -19,6 +19,7 @@ from django.contrib.auth.decorators import login_required from django.contrib.auth import authenticate,login from django.conf import settings +from django.contrib.auth.models import User @@ -93,7 +94,7 @@ # ------------------------------------------------------------------# -class Postlist(LoginRequiredMixin,ListView): +class Postlist(ListView): model = Post template_name = 'chat/home.html' @@ -101,7 +102,7 @@ class Postlist(LoginRequiredMixin,ListView): def get_queryset(self): - username = self.request.user.username + username = self.request.user return User.objects.get(username = username).post_set.all() @@ -186,7 +187,8 @@ def register(request): user = userinfoo.save(commit=False) user.set_password(user.password) user.save() - return HttpResponseRedirect(reverse("chat:home")) + # return HttpResponseRedirect(reverse("chat:auth")) + return authenticating(request) else: @@ -222,7 +224,7 @@ def authenticating(request): return HttpResponse("there is no {} account on this website".format(username)) - else: + else: userinfoo = Userinfo() context = { "userinfoo":userinfoo, diff --git a/django-blog/db.sqlite3 b/django-blog/db.sqlite3 index 4f6b86d..4934a0c 100644 Binary files a/django-blog/db.sqlite3 and b/django-blog/db.sqlite3 differ diff --git a/django-blog/myblog/__pycache__/settings.cpython-37.pyc b/django-blog/myblog/__pycache__/settings.cpython-37.pyc index 09d0519..12c09be 100644 Binary files a/django-blog/myblog/__pycache__/settings.cpython-37.pyc and b/django-blog/myblog/__pycache__/settings.cpython-37.pyc differ diff --git a/django-blog/myblog/settings.py b/django-blog/myblog/settings.py index b65fbee..5a371a7 100644 --- a/django-blog/myblog/settings.py +++ b/django-blog/myblog/settings.py @@ -124,7 +124,8 @@ # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/2.2/howto/static-files/ -STATIC_URL = '/static/' +STATIC_URL = '/chat/static/' + ##LOGIN_REDIRECT_URL = "/chat/home"