Skip to content

Commit b244232

Browse files
committed
Fix urls for about and events to fit with collapsible menus
1 parent 75bbc4d commit b244232

5 files changed

Lines changed: 30 additions & 13 deletions

File tree

apps/about/urls.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
urlpatterns = [
88
path('', views.index, name='index'),
9+
path('us/', views.us, name='us'),
910
path('join/', views.join, name='join'),
1011
path('history/', views.history, name='history'),
1112
]

apps/about/views.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
import logging
22

3-
from django.shortcuts import render
3+
from django.shortcuts import redirect, render
44

55
from apps.members.models import Position
66

77
logger = logging.getLogger(__name__)
88

99

1010
def index(request):
11+
return redirect('about:us')
12+
13+
14+
def us(request):
1115
positions = [p for p in Position.objects.all() if p.active]
1216
return render(
1317
request,

apps/commons/templates/header.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
Asociación
2222
</a>
2323
<div class="navbar-dropdown is-boxed js-nav-dropdown collapsable--close">
24-
<a class="navbar-item {% is_active 'about:index' %}" href="{% url 'about:index' %}">Información</a>
24+
<a class="navbar-item {% is_active 'about:us' %}" href="{% url 'about:us' %}">Información</a>
2525
<a class="navbar-item {% is_active 'about:history' %}" href="{% url 'about:history' %}">Historia</a>
2626
<a class="navbar-item {% is_active 'about:join' %}" href="{% url 'about:join' %}">¡Únete!</a>
2727
</div>
@@ -32,7 +32,7 @@
3232
Eventos
3333
</a>
3434
<div class="navbar-dropdown is-boxed js-nav-dropdown collapsable--close">
35-
<a class="navbar-item {% is_active 'events:index' %}" href="{% url 'events:index' %}">Próximo evento</a>
35+
<a class="navbar-item {% is_active 'events:next' %}" href="{% url 'events:next' %}">Próximo evento</a>
3636
<a class="navbar-item {% is_active 'events:past_events' %}" href="{% url 'events:past_events' %}">Eventos pasados</a>
3737
</div>
3838
</div>
@@ -55,4 +55,4 @@
5555
</div>
5656
</div>
5757
</div>
58-
</nav>
58+
</nav>

apps/events/urls.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
urlpatterns = [
88
path('', views.index, name='index'),
9+
path('next/', views.next, name='next'),
910
path('archive/', views.past_events, name='past_events'),
1011
path('<slug:slug>/', views.detail_event, name='detail_event'),
1112
path(
@@ -60,13 +61,20 @@
6061
name='ticket_purchase_nocc',
6162
),
6263
path('<slug:slug>/raffle/', views.raffle, name='raffle'),
63-
path('<slug:slug>/raffle/<int:gift_id>/',
64-
views.raffle_gift,
65-
name='raffle_gift'),
66-
path('<slug:slug>/raffle/<int:gift_id>/match/',
67-
views.raffle_gift, {'match': True},
68-
name='raffle_gift_match'),
69-
path('<slug:slug>/raffle/results/',
70-
views.raffle_results,
71-
name='raffle_results'),
64+
path(
65+
'<slug:slug>/raffle/<int:gift_id>/',
66+
views.raffle_gift,
67+
name='raffle_gift',
68+
),
69+
path(
70+
'<slug:slug>/raffle/<int:gift_id>/match/',
71+
views.raffle_gift,
72+
{'match': True},
73+
name='raffle_gift_match',
74+
),
75+
path(
76+
'<slug:slug>/raffle/results/',
77+
views.raffle_results,
78+
name='raffle_results',
79+
),
7280
]

apps/events/views.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818

1919

2020
def index(request):
21+
return redirect('events:next')
22+
23+
24+
def next(request):
2125
events = Event.objects.filter(active=True)
2226
num_events = events.count()
2327
if num_events == 0:

0 commit comments

Comments
 (0)