Skip to content

Commit

Permalink
refatorado url da app base
Browse files Browse the repository at this point in the history
  • Loading branch information
thiago-garcia committed Apr 3, 2024
1 parent 08210d3 commit d1069d1
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pypro/base/templates/base/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<a class="navbar-brand" href="{% url 'home' %}">Python Pro</a>
<a class="navbar-brand" href="{% url 'base:home' %}">Python Pro</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
Expand Down
6 changes: 5 additions & 1 deletion pypro/base/tests/test_home.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

@pytest.fixture
def resp(client):
resp = client.get(reverse('home'))
resp = client.get(reverse('base:home'))
return resp


Expand All @@ -16,3 +16,7 @@ def test_status_code(resp):

def test_title(resp):
assert_contains(resp, '<title>Python Pro</title>')


def test_home_link(resp):
assert_contains(resp, f'href="{reverse("base:home")}">Python Pro</a>')
8 changes: 8 additions & 0 deletions pypro/base/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from django.urls import path

from pypro.base.views import home

app_name = 'base'
urlpatterns = [
path('', home, name='home'),
]
3 changes: 1 addition & 2 deletions pypro/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@
from django.contrib import admin
from django.urls import include, path

from pypro.base.views import home

urlpatterns = [
path('admin/', admin.site.urls),
path('', home, name='home'),
path('', include('pypro.base.urls')),
]


Expand Down

0 comments on commit d1069d1

Please sign in to comment.