Backwards compatibility with "shelf" urls
This commit is contained in:
parent
4a490d25a8
commit
f8ce9b0956
|
@ -49,7 +49,7 @@ class Shelf(OrderedCollectionMixin, BookWyrmModel):
|
||||||
def get_remote_id(self):
|
def get_remote_id(self):
|
||||||
""" shelf identifier instead of id """
|
""" shelf identifier instead of id """
|
||||||
base_path = self.user.remote_id
|
base_path = self.user.remote_id
|
||||||
return "%s/shelf/%s" % (base_path, self.identifier)
|
return "%s/books/%s" % (base_path, self.identifier)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
""" user/shelf unqiueness """
|
""" user/shelf unqiueness """
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
<ul>
|
<ul>
|
||||||
{% for shelf_tab in shelves %}
|
{% for shelf_tab in shelves %}
|
||||||
<li class="{% if shelf_tab.identifier == shelf.identifier %}is-active{% endif %}">
|
<li class="{% if shelf_tab.identifier == shelf.identifier %}is-active{% endif %}">
|
||||||
<a href="/user/{{ user | username }}/shelf/{{ shelf_tab.identifier }}"{% if shelf_tab.identifier == shelf.identifier %} aria-current="page"{% endif %}>{% if shelf_tab.identifier == 'to-read' %}{% trans "To Read" %}{% elif shelf_tab.identifier == 'reading' %}{% trans "Currently Reading" %}{% elif shelf_tab.identifier == 'read' %}{% trans "Read" %}{% else %}{{ shelf_tab.name }}{% endif %}</a>
|
<a href="{{ shelf_tab.local_path }}"{% if shelf_tab.identifier == shelf.identifier %} aria-current="page"{% endif %}>{% if shelf_tab.identifier == 'to-read' %}{% trans "To Read" %}{% elif shelf_tab.identifier == 'reading' %}{% trans "Currently Reading" %}{% elif shelf_tab.identifier == 'read' %}{% trans "Read" %}{% else %}{{ shelf_tab.name }}{% endif %}</a>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% with user|username as username %}
|
{% with user|username as username %}
|
||||||
{% if 'user/'|add:username|add:'/books' not in request.path %}
|
{% if 'user/'|add:username|add:'/books' not in request.path and 'user/'|add:username|add:'/shelf' not in request.path %}
|
||||||
<nav class="tabs">
|
<nav class="tabs">
|
||||||
<ul>
|
<ul>
|
||||||
{% url 'user-feed' user|username as url %}
|
{% url 'user-feed' user|username as url %}
|
||||||
|
|
|
@ -154,13 +154,14 @@ urlpatterns = [
|
||||||
# shelf
|
# shelf
|
||||||
re_path(r"%s/books/?$" % user_path, views.user_shelves_page, name="user-shelves"),
|
re_path(r"%s/books/?$" % user_path, views.user_shelves_page, name="user-shelves"),
|
||||||
re_path(
|
re_path(
|
||||||
r"^%s/books/(?P<shelf_identifier>[\w-]+)(.json)?/?$" % user_path,
|
r"^%s/(helf|books)/(?P<shelf_identifier>[\w-]+)(.json)?/?$" % user_path,
|
||||||
views.Shelf.as_view(),
|
views.Shelf.as_view(),
|
||||||
name="shelf",
|
name="shelf",
|
||||||
),
|
),
|
||||||
re_path(
|
re_path(
|
||||||
r"^%s/books/(?P<shelf_identifier>[\w-]+)(.json)?/?$" % local_user_path,
|
r"^%s/(books|shelf)/(?P<shelf_identifier>[\w-]+)(.json)?/?$" % local_user_path,
|
||||||
views.Shelf.as_view(),
|
views.Shelf.as_view(),
|
||||||
|
name="shelf"
|
||||||
),
|
),
|
||||||
re_path(r"^create-shelf/?$", views.create_shelf, name="shelf-create"),
|
re_path(r"^create-shelf/?$", views.create_shelf, name="shelf-create"),
|
||||||
re_path(r"^delete-shelf/(?P<shelf_id>\d+)?$", views.delete_shelf),
|
re_path(r"^delete-shelf/(?P<shelf_id>\d+)?$", views.delete_shelf),
|
||||||
|
|
Loading…
Reference in New Issue