diff options
| author | Bobby <[email protected]> | 2022-08-02 23:07:04 +0530 |
|---|---|---|
| committer | Bobby <[email protected]> | 2022-08-02 23:07:04 +0530 |
| commit | 9a945c6c9bef1e465b44317844c79b4e39bce69c (patch) | |
| tree | 8f764b5b1f8f1e77a4b411d7c0ed3f0a7ee06309 | |
| parent | 73a7b9e9a493951926b64f55fa25f075577812a9 (diff) | |
| download | thatcomputerscientist-9a945c6c9bef1e465b44317844c79b4e39bce69c.tar.xz thatcomputerscientist-9a945c6c9bef1e465b44317844c79b4e39bce69c.zip | |
Added URLs for homepage
| -rw-r--r-- | blog/templates/homepage.html | 7 | ||||
| -rw-r--r-- | blog/templates/partials/sidebar.html | 3 | ||||
| -rw-r--r-- | blog/urls.py | 5 | ||||
| -rw-r--r-- | blog/views.py | 3 |
4 files changed, 16 insertions, 2 deletions
diff --git a/blog/templates/homepage.html b/blog/templates/homepage.html new file mode 100644 index 00000000..73639601 --- /dev/null +++ b/blog/templates/homepage.html @@ -0,0 +1,7 @@ +{% extends 'partials/base.html' %} {% block content %} +<div class="main"> + <section> + <h2>My Homepage</h2> + </section> +</div> +{% endblock %} diff --git a/blog/templates/partials/sidebar.html b/blog/templates/partials/sidebar.html index 259d70b6..cd46c18a 100644 --- a/blog/templates/partials/sidebar.html +++ b/blog/templates/partials/sidebar.html @@ -44,7 +44,8 @@ <li><a href="/contact">Contact</a></li> <li><a href="/blog">Blog</a></li> {% if user.is_authenticated %} - <li><a href="/account">My Account</a></li> + <li><a href="{% url 'account' %}">My Account</a></li> + <li><a href="{% url 'homepage' %}">My Homepage<a></li> {% else %} <li><a href="/register">Register</a></li> {% endif %} diff --git a/blog/urls.py b/blog/urls.py index 65508982..64f89ff7 100644 --- a/blog/urls.py +++ b/blog/urls.py @@ -1,7 +1,10 @@ from django.urls import path +from django.views.generic import RedirectView from . import views urlpatterns = [ path('', views.home, name='home'), - path('account', views.account, name='account'), + path('my/', RedirectView.as_view(pattern_name='account', permanent=False)), + path('my/account', views.account, name='account'), + path('my/homepage', views.homepage, name='homepage'), ] diff --git a/blog/views.py b/blog/views.py index 651cce83..8d3dbe44 100644 --- a/blog/views.py +++ b/blog/views.py @@ -27,3 +27,6 @@ def account(request): else: # Redirect to login page return redirect('/') + +def homepage(request): + return render(request, 'homepage.html', {'title': 'Homepage'}) |
