one liner regex for url path with sub-paths

I want to have 2 URLs


<a href="{% url 'events' %}">Upcoming Events</a>
<a href="{% url 'events' 'past' %}">Past Events</a>
def events(request, timeline='current'):    
    return render(request, 'events.html')

But my regular expression is incorrect :

re_path(r'^events(/(?P<timeline>[^/]+)?)?$',, name='events'),

Is there no simpler way ?

Create two different url entries for the same view but with two different names.

I had to do :

    path('events/past',, kwargs = { 'timeline': 'past' }, name='events_past'),
    path('events',, name = 'events'),

But I was hoping for a one-liner regex.

I’d have taken a different approach.

I would have identified these urls as /events/current/ and /events/past/ allowing me to define the url as path('events/<str:timeline>/',, name='events') making the two urls more consistent with each other.