Exemplo n.º 1
0
 def get_context_data(self, **kwargs):
     context = super(ArticleTagCreate, self).get_context_data(**kwargs)
     context['action'] = 'create'
     context['path'] = (ARTICLE_PATH_ITEM, PathItem('/articles/tag',
                                                    'Tags'),
                        PathItem('/articles/tag/create', 'Create Tag'))
     return context
Exemplo n.º 2
0
 def get_context_data(self, **kwargs):
     context = super(FileUpdate, self).get_context_data(**kwargs)
     context['id'] = self.object.pk
     context['path'] = (PathItem('/files', 'Files'),
                        PathItem('/files/update/' + str(self.object.pk),
                                 'Update File'))
     return context
Exemplo n.º 3
0
 def get_context_data(self, **kwargs):
     context = super(PhotoUpdate, self).get_context_data(**kwargs)
     context['id'] = self.object.pk
     context['path'] = (PathItem('/photos', 'Photos'),
                        PathItem('/photos/update/' + str(self.object.pk),
                                 'Update Photo'))
     return context
Exemplo n.º 4
0
 def get_context_data(self, **kwargs):
     context = super(PhotoTagCreate, self).get_context_data(**kwargs)
     context['action'] = 'create'
     context['path'] = (PathItem('/photos',
                                 'Photos'), PathItem('/photos/tag', 'Tags'),
                        PathItem('/photos/tag/create', 'Create Tag'))
     return context
Exemplo n.º 5
0
 def get_context_data(self, **kwargs):
     context = super(PhotoGallery, self).get_context_data(**kwargs)
     context['photos'] = Photo.objects.filter(
         display_in_gallery=True).order_by('-date').select_related()
     context['tags'] = PhotoTag.objects
     context['path'] = (PathItem('/photos', 'Photos'),
                        PathItem('/photos/gallery', 'Gallery'))
     return context
Exemplo n.º 6
0
 def get_context_data(self, **kwargs):
     context = super(PhotoTagDelete, self).get_context_data(**kwargs)
     context['tag'] = self.object
     context['path'] = (PathItem('/photos',
                                 'Photos'), PathItem('/photos/tag', 'Tags'),
                        PathItem(
                            '/photos/tag/delete/' + str(self.object.pk),
                            'Confirm Delete Photo Tag'))
     return context
Exemplo n.º 7
0
 def get_context_data(self, **kwargs):
     context = super(ArticleTagDelete, self).get_context_data(**kwargs)
     context['tag'] = self.object
     context['path'] = (ARTICLE_PATH_ITEM, PathItem('/articles/tag',
                                                    'Tags'),
                        PathItem(
                            '/articles/tag/delete/' + str(self.object.pk),
                            'Confirm Delete Article Tag'))
     return context
Exemplo n.º 8
0
 def get_context_data(self, **kwargs):
     context = super(PhotoTagUpdate, self).get_context_data(**kwargs)
     context['action'] = 'update'
     context['id'] = self.object.pk
     context['path'] = (PathItem('/photos',
                                 'Photos'), PathItem('/photos/tag', 'Tags'),
                        PathItem(
                            '/photos/tag/update/' + str(self.object.pk),
                            'Update Tag'))
     return context
Exemplo n.º 9
0
 def get_context_data(self, **kwargs):
     context = super(ArticleTagUpdate, self).get_context_data(**kwargs)
     context['action'] = 'update'
     context['id'] = self.object.pk
     context['path'] = (ARTICLE_PATH_ITEM, PathItem('/articles/tag',
                                                    'Tags'),
                        PathItem(
                            '/articles/tag/update/' + str(self.object.pk),
                            'Update Tag'))
     return context
Exemplo n.º 10
0
 def get_context_data(self, **kwargs):
     context = super(ArticleDetail, self).get_context_data(**kwargs)
     article = self.object
     context['article'] = article
     context['path'] = (ARTICLE_PATH_ITEM,
                        PathItem('/articles/detail/' + str(self.object.pk),
                                 'Article Detail'))
     context['comment_action'] = 'create'
     context['comment_form'] = ArticleCommentForm({'article': self.object})
     return context
Exemplo n.º 11
0
 def get_context_data(self, **kwargs):
     context = super(PhotoList, self).get_context_data(**kwargs)
     context['photos'] = Photo.objects.order_by('date').select_related()
     context['path'] = (PathItem('/photos', 'Photos'), )
     return context
Exemplo n.º 12
0
 def get_context_data(self, **kwargs):
     context = super(PhotoTagList, self).get_context_data(**kwargs)
     context['photo_tags'] = PhotoTag.objects.order_by('display_name')
     context['path'] = (PathItem('/photos',
                                 'Photos'), PathItem('/photos/tag', 'Tags'))
     return context
Exemplo n.º 13
0
 def get_context_data(self, **kwargs):
     context = super(AboutWebsiteView, self).get_context_data(**kwargs)
     context['path'] = (PathItem('/about/website/', 'About Website'), )
     return context
Exemplo n.º 14
0
 def get_context_data(self, **kwargs):
     context = super(ArticleTagList, self).get_context_data(**kwargs)
     context['article_tags'] = ArticleTag.objects.order_by('display_name')
     context['path'] = (ARTICLE_PATH_ITEM, PathItem('/articles/tag',
                                                    'Tags'))
     return context
Exemplo n.º 15
0
 def get_context_data(self, **kwargs):
     context = super(PhotoUpload, self).get_context_data(**kwargs)
     context['path'] = (PathItem('/photos', 'Photos'),
                        PathItem('/photos/upload', 'Upload Photo'))
     return context
Exemplo n.º 16
0
 def get_context_data(self, **kwargs):
     context = super(FileUpload, self).get_context_data(**kwargs)
     context['path'] = (PathItem('/files', 'Files'),
                        PathItem('/files/upload', 'Upload File'))
     return context
Exemplo n.º 17
0
 def get_context_data(self, **kwargs):
     context = super(FileList, self).get_context_data(**kwargs)
     context['files'] = File.objects.order_by('name').select_related()
     context['path'] = (PathItem('/files', 'Files'), )
     return context
Exemplo n.º 18
0
 def get_context_data(self, **kwargs):
     context = super(LoginView, self).get_context_data(**kwargs)
     context['next'] = self.request.GET.get('next')
     context['path'] = (PathItem('/home/login', 'Login'), )
     return context
Exemplo n.º 19
0
 def get_context_data(self, **kwargs):
     context = super(AboutProfileView, self).get_context_data(**kwargs)
     context['path'] = (PathItem('/about/profile/', 'Profile'), )
     return context
Exemplo n.º 20
0
from django.http.request import HttpRequest
from django.http.response import HttpResponseRedirect, HttpResponse, \
    HttpResponseNotFound, HttpResponseForbidden
from django.views.generic.base import TemplateView, RedirectView
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.views.generic.detail import DetailView
from django.contrib.auth.decorators import login_required
from django.utils import simplejson
from django.views.decorators.csrf import csrf_exempt
from articles.models import Article, ArticleTag, ArticleComment
from articles.forms import ArticleForm, ArticleTagForm, ArticleCommentForm
from home.models import PathItem
from home.authentication import require_login, require_admin, is_admin
import wordpress

ARTICLE_PATH_ITEM = PathItem('/articles', 'Article')


class ArticleList(TemplateView):
    template_name = 'article_list.html'

    def get_context_data(self, **kwargs):
        context = super(ArticleList, self).get_context_data(**kwargs)
        '''
        articles = Article.objects
        if not self.request.user.is_authenticated() or not is_admin(self.request.user):
            articles = articles.filter(is_draft=False)
        articles = articles.order_by('-create_date_time').select_related()
        '''
        '''
            Read articles from wordpress database and create article objects