Commit bbf420db authored by Deokhyun Lee's avatar Deokhyun Lee

View for Authors list is now in order of its id

parent 3536d9d2
Pipeline #2965 canceled with stages
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
{% if authors %} {% if authors %}
<ul> <ul>
{% for author in authors %} {% for author in authors %}
<a href={{author.id}}/details>{{ author.first_name }} {{ author.last_name}}</a><br> <a href={{author.id}}/details>{{ author.first_name }} {{ author.last_name}} {{ author.id }}</a><br>
{% endfor %} {% endfor %}
</ul> </ul>
{% else %} {% else %}
......
...@@ -3,7 +3,7 @@ from .views import HomeView, AuthorListView, AuthorDetailView, BookListView, Boo ...@@ -3,7 +3,7 @@ from .views import HomeView, AuthorListView, AuthorDetailView, BookListView, Boo
urlpatterns = [ urlpatterns = [
# for Home (landing page) # for Home (landing page)
path('', HomeView.as_view(), name='home'), path('home/', HomeView.as_view(), name='home'),
# for Authors page # for Authors page
path('authors/', AuthorListView.as_view(), name='authors'), path('authors/', AuthorListView.as_view(), name='authors'),
path('authors/<int:pk>/details', AuthorDetailView.as_view(), name='author-detail'), path('authors/<int:pk>/details', AuthorDetailView.as_view(), name='author-detail'),
......
...@@ -13,7 +13,7 @@ class AuthorListView(ListView): ...@@ -13,7 +13,7 @@ class AuthorListView(ListView):
model = Author model = Author
template_name = 'authors/index.html' template_name = 'authors/index.html'
context_object_name = 'authors' context_object_name = 'authors'
ordering = ['first_name'] ordering = ['id']
class AuthorDetailView(DetailView): class AuthorDetailView(DetailView):
model = Author model = Author
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment