Commit 93f68bf0 authored by Floréal Cabanettes's avatar Floréal Cabanettes

Fix urls name for website

parent ab104893
......@@ -8,17 +8,17 @@ from .views import IndexView, RecipeView, LoginView, LogoutView
favicon_view = RedirectView.as_view(url='/static/favicon.ico', permanent=True)
urlpatterns = [
url(r'^$', IndexView.as_view(), name='index'),
url(r'^$', IndexView.as_view(), name='website_index'),
url(r'^login/', LoginView.as_view(), name='login'),
url(r'^logout/', LogoutView.as_view(), name='logout'),
url(r'^' + _("page") + '/(?P<page>\d+)$', IndexView.as_view(), name='index_page'),
url(r'^' + pgettext("category url", "category") + "/(?P<cat>[\w-]+)$", IndexView.as_view(), name='category'),
url(r'^' + _("page") + '/(?P<page>\d+)$', IndexView.as_view(), name='website_index_page'),
url(r'^' + pgettext("category url", "category") + "/(?P<cat>[\w-]+)$", IndexView.as_view(), name='website_category'),
url(r'^' + pgettext("category url", "category") + "/(?P<cat>[\w-]+)/" + _("page") + '/(?P<page>\d+)$',
IndexView.as_view(), name='category_page'),
url(r'^' + pgettext("author url", "author") + "/(?P<author>[\w-]+)$", IndexView.as_view(), name='author'),
IndexView.as_view(), name='website_category_page'),
url(r'^' + pgettext("author url", "author") + "/(?P<author>[\w-]+)$", IndexView.as_view(), name='website_author'),
url(r'^' + pgettext("author url", "author") + "/(?P<author>[\w-]+)/" + _("page") + '/(?P<page>\d+)$',
IndexView.as_view(), name='author_page'),
IndexView.as_view(), name='website_author_page'),
# Translators: recipe is the parent tag of a recipe
url(r'^' + _("recipe") + '/(?P<slug>\w+)$', RecipeView.as_view(), name='recipe'),
url(r'^' + _("recipe") + '/(?P<slug>\w+)$', RecipeView.as_view(), name='website_recipe'),
url(r'^favicon\.ico$', favicon_view),
]
......@@ -30,7 +30,7 @@ class IndexView(TemplateView):
def data(self):
categories = GenericView.categories()
config = GenericView.config
dat = {"in_archive": False, "page_view_name": "index_page", "additional_kwargs": {}, "categories": categories,
dat = {"in_archive": False, "page_view_name": "website_index_page", "additional_kwargs": {}, "categories": categories,
"config": config, "user": self.user if self.user.is_authenticated else None}
if self.user.is_authenticated:
dat["avatar"] = get_gravatar_url(self.user.email, size=160)
......@@ -40,13 +40,13 @@ class IndexView(TemplateView):
page = self.kwargs["page"]
if "cat" in self.kwargs:
dat["in_archive"] = True
dat["page_view_name"] = "category_page"
dat["page_view_name"] = "website_category_page"
dat["archive_header"] = Category.objects.get(url=self.kwargs["cat"]).name
dat["additional_kwargs"] = {"cat": self.kwargs["cat"]}
recipes = Recipe.objects.filter(category__url=self.kwargs["cat"]).order_by("-pub_date")
elif "author" in self.kwargs:
dat["in_archive"] = True
dat["page_view_name"] = "author_page"
dat["page_view_name"] = "website_author_page"
dat["archive_header"] = _("Author:") + " " + \
UserProfile.objects.get(url=self.kwargs["author"]).user.first_name
dat["additional_kwargs"] = {"author": self.kwargs["author"]}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment