Add a new index page

This commit is contained in:
Trever Fischer
2012-04-17 01:40:50 -04:00
parent dc8eb80e6c
commit 74faaa136e
2 changed files with 30 additions and 0 deletions

View File

@@ -12,6 +12,8 @@ from django.contrib.auth import authenticate, login
from django.core.exceptions import ObjectDoesNotExist
import forms
import models
from forums.models import Forum
from news.models import Post
from minecraft.forms import ProfileForm
@login_required
@@ -112,3 +114,8 @@ def claimInvite(request, code=None):
def list(request):
profiles = User.objects.all()
return render_to_response('local/list.html', {'profiles': profiles}, context_instance = RequestContext(request))
def index(request):
latestNews = Post.objects.all()[0]
forums = Forum.objects.filter(parent=None)
return render_to_response('local/index.html', {'news': latestNews, 'forums': forums}, context_instance = RequestContext(request))

View File

@@ -0,0 +1,23 @@
{% extends "base.html" %}
{% load minecraft %}
{% load markup %}
{%block title %}Caminus{% endblock %}
{% block content %}
<div class='item news-item'>
<h2><a href="{{news.get_absolute_url}}">{{news.title}}</a></h2>
<div class="byline">By <span itemprop="author">{{news.author}}</span> <div class="avatar">{% avatar news.author %}</div></div>
<div class="dateline">On {{news.created}}</div>
<div class="content" itemprop="articleBody">
{{news.body|truncatewords:"100"|markdown}}
</div>
<div class="commentcount"><a href="{{news.get_absolute_url}}"><span itemprop="interactionCount">{{news.comments.all|length}} comment{{news.comments.all|length|pluralize}}</span> &raquo;</a></div>
<br style="clear:both"/>
<a href="{% url news.views.index %}">News Archive &raquo;</a>
</div>
<div class="item">
<h2>Forums</h2>
{%include "forums/_forum_table.html" with forums=forums%}
</div>
{%endblock%}