Skip to content

Commit

Permalink
new front-end
Browse files Browse the repository at this point in the history
  • Loading branch information
vuhoang17891 committed Jan 17, 2021
1 parent 25030ad commit 0379ca3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion main/templates/main/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ <h3 class="card-title">Ứng dụng quản lý chi tiêu nên-tải-về cho du
</div>
</div>
</div>
{% for article in articles %}
{% for article in articles|slice:":2" %}
<div class="col-lg-3 col-md-6">
<div class="card card-news">
<h5 class="card-header card-red-header">Bài viết</h5>
Expand All @@ -95,6 +95,17 @@ <h5 class="card-header card-red-header">Bài viết</h5>
</div>
</div>
{% endfor %}
{% for article in articles|slice:"2:" %}
<div class="col-lg-6">
<div class="card card-news">
<h5 class="card-header card-red-header">Bài viết</h5>
<div class="card-body">
<a href="{% url 'article_detail' article_id=article.id %}"> <h4 class="card-title">{{ article.title }}</h4></a>
<p class="card-text">{{ article.body|striptags|safe|truncatewords_html:40 }}</p>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion main/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

def index(request):
universities = University.objects.all()[:6]
articles = Article.objects.order_by('-date')[:2]
articles = Article.objects.order_by('-date')[:4]
subjects = Subject.objects.filter(unisubject__isnull=False).distinct()[:3]
return render(request, 'main/index.html',
context={'universities': universities, 'articles': articles, 'subjects': subjects})
Expand Down

0 comments on commit 0379ca3

Please sign in to comment.