Merge pull request 'blog/create is now just accessible if you have the staff flag' (#3) from create_as_staff into master
Reviewed-on: #3pull/4/head
commit
21624d015b
|
|
@ -1,7 +1,10 @@
|
||||||
|
from django.db.models import QuerySet
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.contrib.auth.mixins import *
|
from django.contrib.auth.mixins import *
|
||||||
from django.views.generic import *
|
from django.views.generic import *
|
||||||
from .models import *
|
from .models import *
|
||||||
|
from django.contrib.admin.views.decorators import staff_member_required
|
||||||
|
from django.utils.decorators import method_decorator
|
||||||
|
|
||||||
|
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
|
|
@ -42,6 +45,7 @@ class BlogDetailView(DetailView):
|
||||||
template_name = 'blog/blogDetail.html'
|
template_name = 'blog/blogDetail.html'
|
||||||
|
|
||||||
|
|
||||||
|
@method_decorator(staff_member_required, name='dispatch')
|
||||||
class BlogCreateView(LoginRequiredMixin, CreateView):
|
class BlogCreateView(LoginRequiredMixin, CreateView):
|
||||||
model = Blog
|
model = Blog
|
||||||
template_name = 'blog/blogCreate.html'
|
template_name = 'blog/blogCreate.html'
|
||||||
|
|
@ -55,8 +59,10 @@ class BlogCreateView(LoginRequiredMixin, CreateView):
|
||||||
def dev(request):
|
def dev(request):
|
||||||
return render(request, 'dev.html', {'title': 'Development'})
|
return render(request, 'dev.html', {'title': 'Development'})
|
||||||
|
|
||||||
|
|
||||||
def support(request):
|
def support(request):
|
||||||
return render(request, 'support.html', {'title': 'Support Us'})
|
return render(request, 'support.html', {'title': 'Support Us'})
|
||||||
|
|
||||||
|
|
||||||
def home(request):
|
def home(request):
|
||||||
return render(request, 'index.html', {'title': 'Home'})
|
return render(request, 'index.html', {'title': 'Home'})
|
||||||
Loading…
Reference in New Issue