cleanup, better admin
This commit is contained in:
parent
d5b3076645
commit
b8f1c52613
15 changed files with 124 additions and 24 deletions
|
|
@ -12,7 +12,10 @@ def index(request):
|
|||
|
||||
def page(request, slug=''):
|
||||
context = {}
|
||||
page = models.Page.objects.filter(slug=slug, public=True).first()
|
||||
if request.user.is_staff:
|
||||
page = models.Page.objects.filter(slug=slug).first()
|
||||
else:
|
||||
page = models.Page.objects.filter(slug=slug, public=True).first()
|
||||
if page:
|
||||
context['page'] = page
|
||||
return render(request, 'page.html', context)
|
||||
|
|
@ -24,10 +27,13 @@ def about(request):
|
|||
|
||||
def texts(request):
|
||||
context = {}
|
||||
context['texts'] = models.Text.objects.filter(public=True).order_by('created')
|
||||
context['texts'] = models.Text.objects.filter(public=True).order_by('position', 'created')
|
||||
return render(request, 'texts.html', context)
|
||||
|
||||
def text(request, slug):
|
||||
context = {}
|
||||
context['text'] = get_object_or_404(models.Text, slug=slug)
|
||||
if request.user.is_staff:
|
||||
context['text'] = get_object_or_404(models.Text, slug=slug)
|
||||
else:
|
||||
context['text'] = get_object_or_404(models.Text, slug=slug, public=True)
|
||||
return render(request, 'text.html', context)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue