Saturday, July 9, 2016

NoReverseMatch at /accounts/accounts/auth/

from django.contrib.auth.decorators import login_required
from django.shortcuts import render, redirect, get_object_or_404
from django.utils import timezone

from models import Post
from .forms import PostForm


@login_required
def message(request):
posts = Post.objects.order_by('-created_date')
return render(request, 'post_list.html', {'xyz': posts})


@login_required
def post_new(request):
if request.method == "POST":
form = PostForm(request.POST)
if form.is_valid():
post = form.save(commit=False)
post.author = request.user
post.published_date = timezone.now()
post.save()
return redirect('message_board:list')
else:
form = PostForm()
return render(request, 'post_edit.html', {'form': form})


def post_detail(request, pk=None):
print request, pk
post = get_object_or_404(Post, pk=pk)
return render(request, 'post_detail.html', {'post': post})
I tried my best to solve this but i couldn't please help me 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/27bcddf9-9ba2-4fab-bb18-ce9a81048ae9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment