2008-06-26 14:36:58 +00:00
|
|
|
from django.shortcuts import get_object_or_404
|
|
|
|
from django.http import HttpResponseRedirect
|
2008-07-25 15:38:11 +00:00
|
|
|
from django.contrib.admin.views.decorators import staff_member_required
|
2008-06-26 14:36:58 +00:00
|
|
|
|
2008-06-27 19:20:32 +00:00
|
|
|
from scrapyorg.article.models import Article
|
2008-06-26 14:36:58 +00:00
|
|
|
|
|
|
|
|
2008-07-25 15:38:11 +00:00
|
|
|
@staff_member_required
|
2008-06-27 02:10:11 +00:00
|
|
|
def position_up(request, article_id):
|
2008-06-26 14:36:58 +00:00
|
|
|
article = get_object_or_404(Article, pk=article_id)
|
2008-06-27 02:10:11 +00:00
|
|
|
article.position_up()
|
2008-06-26 14:36:58 +00:00
|
|
|
return HttpResponseRedirect("/admin/article/article/")
|
|
|
|
|
2008-07-25 15:38:11 +00:00
|
|
|
@staff_member_required
|
2008-06-27 02:10:11 +00:00
|
|
|
def position_down(request, article_id):
|
2008-06-26 14:36:58 +00:00
|
|
|
article = get_object_or_404(Article, pk=article_id)
|
2008-06-27 02:10:11 +00:00
|
|
|
article.position_down()
|
2008-06-26 14:36:58 +00:00
|
|
|
return HttpResponseRedirect("/admin/article/article/")
|
2008-07-25 16:59:27 +00:00
|
|
|
|
|
|
|
@staff_member_required
|
|
|
|
def publish_toggle(request, article_id):
|
|
|
|
article = get_object_or_404(Article, pk=article_id)
|
|
|
|
article.toggle_publish()
|
|
|
|
return HttpResponseRedirect("/admin/article/article/")
|