Skip to content

Commit

Permalink
split wiki_title and page_title.
Browse files Browse the repository at this point in the history
  • Loading branch information
soasme committed Apr 27, 2017
1 parent 4635ccc commit df1cb38
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion wikisensei/web/templates/wiki/show.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{% load web %}

{% block title %}
{{ wiki.title }}
{{ title }}
{% endblock %}

{% block content %}
Expand Down
13 changes: 8 additions & 5 deletions wikisensei/web/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def help(request):


class WikiDetail(APIView):
page_title = None
renderer_classes = [TemplateHTMLRenderer]
template_name = 'wiki/show.html'
permission_classes = (
Expand Down Expand Up @@ -97,6 +98,7 @@ def get(self, request, pk, version=None):
'serializer': serializer,
'wiki': wiki,
'style': get_custom_style(wiki.user),
'title': self.page_title or wiki.title,
})

class WikiCreate(APIView):
Expand Down Expand Up @@ -254,11 +256,11 @@ def get(self, request):
})

class SiteWikiPage(WikiDetail):
page_title = ROOT_WIKI_TITLE
wiki_title = ROOT_WIKI_TITLE

def get(self, request):
user = get_object_or_404(User, username=settings.SITE_USERNAME)
wiki = get_object_or_404(Wiki, user=user, title=self.__class__.page_title)
wiki = get_object_or_404(Wiki, user=user, title=self.__class__.wiki_title)
return super(SiteWikiPage, self).get(request, wiki.pk)

class UserWikiHome(WikiDetail):
Expand All @@ -269,13 +271,14 @@ def get(self, request, username):
return super(UserWikiHome, self).get(request, wiki.pk)

class Home(SiteWikiPage):
page_title = 'Home'
wiki_title = 'Home'
page_title = 'Tomato'

class Price(SiteWikiPage):
page_title = 'Price'
wiki_title = 'Price'

class Help(SiteWikiPage):
page_title = 'Help'
wiki_title = 'Help'

class Profile(APIView):
renderer_classes = [TemplateHTMLRenderer]
Expand Down

0 comments on commit df1cb38

Please sign in to comment.