def article(request, alies):
args = {}
args.update(csrf(request))
try:
args['article'] = Article.objects.get(alies=alies)
except Article.DoesNotExist:
head_id = get_object_or_404(Heading, heading_alies=alies)
args['article'] = Article.objects.filter(article_heading=head_id.id)
if not args['article']:
tag_id = get_object_or_404(Tag, tag_alies=alies)
args['article'] = Article.objects.filter(tags=tag_id.id)
else:
pass
args['heading'] = Heading.objects.all()
return render_to_response('article.html', args)
head_id = get_object_or_404(Heading, heading_alies=alies)
head_id = get_object_or_404(Heading, heading_alies=alies)
heading = get_object_or_404(Heading, heading_alies=alies)
def article(request, alies):
args = {}
args.update(csrf(request))
try:
args['article'] = Article.objects.get(alies=alies)
except Article.DoesNotExist:
try:
head_id = Heading.objects.get(heading_alies=head_id)
args['article'] = Article.objects.filter(article_heading=head_id.id)
except Heading.DoesNotExist:
tag_id = get_object_or_404(Tag, tag_alies=alies)
args['article'] = Article.objects.filter(tags_id=tag_id.id)
args['heading'] = Heading.objects.all()
return render_to_response('article.html', args)