0
I’m studying Django 2.0.2, and I’m having difficulties in URL friendly together with Slugfield in the models.py class, but I don’t know how to define def get_absolute_url(self):
correctly. I can access directly through the URL. Missing now set the function in the models class to work. Could anyone help me?
Below the url of my app.
from django.urls import include, path, re_path
from simplemooc.courses import views
app_name='courses'
urlpatterns = [
path('', views.index, name='index'),
re_path('(?P<slug>[\w-]+)/$', views.details, name='details'),
]
I also looked at Django’s documentation, but I still don’t understand: URL dispatcher.