File size: 882 Bytes
ce4b573 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | # -*- coding: utf-8 -*-
from django.shortcuts import render, get_object_or_404
from threads.models import Subject, Thread, Post
from django.shortcuts import redirect
from django.contrib import messages, auth
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.template.context_processors import csrf
# Create your views here.
def forum(request):
"""
forum(): pull the all subjects from the database and pass them to our view
"""
return render(request, 'forum/forum.html', {'subjects': Subject.objects.all()})
def threads(request, subject_id):
"""
threads():
"""
subject = get_object_or_404(Subject, pk=subject_id)
return render(request, 'forum/threads.html', {'subject': subject})
@login_required
def new_thread(request, subject_id):
"""
new_thread():
"""
pass
|