diff --git a/books/templates/books/delete.html b/books/templates/books/delete.html index 98e1cd22..94cdd203 100644 --- a/books/templates/books/delete.html +++ b/books/templates/books/delete.html @@ -55,7 +55,7 @@ {% if book.last_editor %}
{% trans '最近编辑者:' %} - + {{ book.last_editor | default:"" }}
diff --git a/books/templates/books/delete_review.html b/books/templates/books/delete_review.html index b5c33a7b..f44be6bc 100644 --- a/books/templates/books/delete_review.html +++ b/books/templates/books/delete_review.html @@ -47,7 +47,7 @@
- {{ review.owner.username }} {% if mark %} diff --git a/books/templates/books/detail.html b/books/templates/books/detail.html index 33104c90..042e3290 100644 --- a/books/templates/books/detail.html +++ b/books/templates/books/detail.html @@ -103,7 +103,7 @@ {% if book.last_editor %} -
{% trans '最近编辑者:' %}{{ book.last_editor | default:"" }}
+
{% trans '最近编辑者:' %}{{ book.last_editor | default:"" }}
{% endif %}
@@ -163,7 +163,7 @@
    {% for others_mark in mark_list %}
  • - {{ others_mark.owner.username }} + {{ others_mark.owner.username }} {{ others_mark.get_status_display }} {% if others_mark.rating %} @@ -191,7 +191,7 @@
      {% for others_review in review_list %}
    • - {{ others_review.owner.username }} + {{ others_review.owner.username }} {% if others_review.visibility > 0 %} {% endif %} diff --git a/books/templates/books/mark_list.html b/books/templates/books/mark_list.html index 0eb401bb..ecc819e0 100644 --- a/books/templates/books/mark_list.html +++ b/books/templates/books/mark_list.html @@ -38,7 +38,7 @@ {% for mark in marks %}
    • - {{ mark.owner.username }} {{ mark.get_status_display }} {% if mark.rating %} diff --git a/books/templates/books/review_detail.html b/books/templates/books/review_detail.html index dbb2383e..408ab574 100644 --- a/books/templates/books/review_detail.html +++ b/books/templates/books/review_detail.html @@ -46,7 +46,7 @@
      - {{ review.owner.username }} + {{ review.owner.username }} {% if mark %} diff --git a/books/templates/books/review_list.html b/books/templates/books/review_list.html index 23f5aee5..2ec2ef51 100644 --- a/books/templates/books/review_list.html +++ b/books/templates/books/review_list.html @@ -39,7 +39,7 @@
    • - {{ review.owner.username }} + {{ review.owner.username }} {% if review.visibility > 0 %} {% endif %} diff --git a/collection/templates/delete.html b/collection/templates/delete.html index c170540e..7a689593 100644 --- a/collection/templates/delete.html +++ b/collection/templates/delete.html @@ -50,7 +50,7 @@
      - {{ collection.owner.mastodon_username }} + {{ collection.owner.mastodon_username }} {{ collection.edited_time }} diff --git a/collection/templates/detail.html b/collection/templates/detail.html index 022eb86e..2616c572 100644 --- a/collection/templates/detail.html +++ b/collection/templates/detail.html @@ -51,7 +51,7 @@
      - {{ collection.owner.mastodon_username }} + {{ collection.owner.mastodon_username }} {{ collection.edited_time }} diff --git a/games/templates/games/delete.html b/games/templates/games/delete.html index 041375db..0e1f8d40 100644 --- a/games/templates/games/delete.html +++ b/games/templates/games/delete.html @@ -55,7 +55,7 @@ {% if game.last_editor %}
      {% trans '最近编辑者:' %} - + {{ game.last_editor | default:"" }}
      diff --git a/games/templates/games/delete_review.html b/games/templates/games/delete_review.html index 0923f397..fc7b6d40 100644 --- a/games/templates/games/delete_review.html +++ b/games/templates/games/delete_review.html @@ -46,7 +46,7 @@
      - {{ review.owner.username }} {% if mark %} diff --git a/games/templates/games/detail.html b/games/templates/games/detail.html index e6531b02..bd3dcc00 100644 --- a/games/templates/games/detail.html +++ b/games/templates/games/detail.html @@ -136,7 +136,7 @@ {% if game.last_editor %} -
      {% trans '最近编辑者:' %}{{ game.last_editor | default:"" }}
      +
      {% trans '最近编辑者:' %}{{ game.last_editor | default:"" }}
      {% endif %}
      @@ -188,7 +188,7 @@
        {% for others_mark in mark_list %}
      • - {{ others_mark.owner.username }} + {{ others_mark.owner.username }} {{ others_mark.get_status_display }} {% if others_mark.rating %} @@ -217,7 +217,7 @@
          {% for others_review in review_list %}
        • - {{ others_review.owner.username }} + {{ others_review.owner.username }} {% if others_review.visibility > 0 %} {% endif %} diff --git a/games/templates/games/mark_list.html b/games/templates/games/mark_list.html index c2838fe6..a27442d9 100644 --- a/games/templates/games/mark_list.html +++ b/games/templates/games/mark_list.html @@ -40,7 +40,7 @@ {% for mark in marks %}
        • - {{ mark.owner.username }} {{ mark.get_status_display }} {% if mark.rating %} diff --git a/games/templates/games/review_detail.html b/games/templates/games/review_detail.html index 8a442183..b5e60189 100644 --- a/games/templates/games/review_detail.html +++ b/games/templates/games/review_detail.html @@ -48,7 +48,7 @@
          - {{ review.owner.username }} + {{ review.owner.username }} {% if mark %} diff --git a/games/templates/games/review_list.html b/games/templates/games/review_list.html index 738cd057..1b2df085 100644 --- a/games/templates/games/review_list.html +++ b/games/templates/games/review_list.html @@ -41,7 +41,7 @@
        • - {{ review.owner.username }} + {{ review.owner.username }} {% if review.visibility > 0 %} {% endif %} diff --git a/movies/templates/movies/delete.html b/movies/templates/movies/delete.html index 96e9dbc2..acc9bcce 100644 --- a/movies/templates/movies/delete.html +++ b/movies/templates/movies/delete.html @@ -62,7 +62,7 @@ {% if movie.last_editor %}
          {% trans '最近编辑者:' %} - + {{ movie.last_editor | default:"" }}
          diff --git a/movies/templates/movies/delete_review.html b/movies/templates/movies/delete_review.html index 536b3da6..6f78f51f 100644 --- a/movies/templates/movies/delete_review.html +++ b/movies/templates/movies/delete_review.html @@ -46,7 +46,7 @@
          - {{ review.owner.username }} {% if mark %} diff --git a/movies/templates/movies/detail.html b/movies/templates/movies/detail.html index f04bcc27..5e6c0a09 100644 --- a/movies/templates/movies/detail.html +++ b/movies/templates/movies/detail.html @@ -200,7 +200,7 @@ {% if movie.last_editor %} -
          {% trans '最近编辑者:' %}{{ movie.last_editor | default:"" }}
          +
          {% trans '最近编辑者:' %}{{ movie.last_editor | default:"" }}
          {% endif %}
          @@ -259,7 +259,7 @@
            {% for others_mark in mark_list %}
          • - {{ others_mark.owner.username }} + {{ others_mark.owner.username }} {{ others_mark.get_status_display }} {% if others_mark.rating %} @@ -292,7 +292,7 @@
              {% for others_review in review_list %}
            • - {{ others_review.owner.username }} + {{ others_review.owner.username }} {% if others_review.visibility > 0 %} {% endif %} diff --git a/movies/templates/movies/mark_list.html b/movies/templates/movies/mark_list.html index 0d50e2bb..9fa50806 100644 --- a/movies/templates/movies/mark_list.html +++ b/movies/templates/movies/mark_list.html @@ -40,7 +40,7 @@ {% for mark in marks %}
            • - {{ mark.owner.username }} {{ mark.get_status_display }} {% if mark.rating %} diff --git a/movies/templates/movies/review_detail.html b/movies/templates/movies/review_detail.html index 0a9ef162..72da880c 100644 --- a/movies/templates/movies/review_detail.html +++ b/movies/templates/movies/review_detail.html @@ -48,7 +48,7 @@
              - {{ review.owner.username }} + {{ review.owner.username }} {% if mark %} diff --git a/movies/templates/movies/review_list.html b/movies/templates/movies/review_list.html index 7e96e5ec..91193bb8 100644 --- a/movies/templates/movies/review_list.html +++ b/movies/templates/movies/review_list.html @@ -41,7 +41,7 @@
            • - {{ review.owner.username }} + {{ review.owner.username }} {% if review.visibility > 0 %} {% endif %} diff --git a/music/templates/music/album_detail.html b/music/templates/music/album_detail.html index 48f8b797..400cad3f 100644 --- a/music/templates/music/album_detail.html +++ b/music/templates/music/album_detail.html @@ -130,7 +130,7 @@ {% if album.last_editor %} -
              {% trans '最近编辑者:' %}{{ album.last_editor | default:"" }}
              +
              {% trans '最近编辑者:' %}{{ album.last_editor | default:"" }}
              {% endif %}
              @@ -224,7 +224,7 @@
                {% for others_mark in mark_list %}
              • - {{ others_mark.owner.username }} + {{ others_mark.owner.username }} {{ others_mark.get_status_display }} {% if others_mark.rating %} @@ -253,7 +253,7 @@
                  {% for others_review in review_list %}
                • - {{ others_review.owner.username }} + {{ others_review.owner.username }} {% if others_review.visibility > 0 %} {% endif %} diff --git a/music/templates/music/album_mark_list.html b/music/templates/music/album_mark_list.html index fddb3810..453ac68e 100644 --- a/music/templates/music/album_mark_list.html +++ b/music/templates/music/album_mark_list.html @@ -40,7 +40,7 @@ {% for mark in marks %}
                • - {{ mark.owner.username }} {{ mark.get_status_display }} {% if mark.rating %} diff --git a/music/templates/music/album_review_detail.html b/music/templates/music/album_review_detail.html index 06be286a..d299bbd5 100644 --- a/music/templates/music/album_review_detail.html +++ b/music/templates/music/album_review_detail.html @@ -48,7 +48,7 @@
                  - {{ review.owner.username }} {% if mark %} diff --git a/music/templates/music/album_review_list.html b/music/templates/music/album_review_list.html index 63eca05a..8605ac5b 100644 --- a/music/templates/music/album_review_list.html +++ b/music/templates/music/album_review_list.html @@ -40,7 +40,7 @@
                • - {{ review.owner.username }} {% if review.visibility > 0 %} {% trans '最近编辑者:' %} - + {{ album.last_editor | default:"" }}
              diff --git a/music/templates/music/delete_album_review.html b/music/templates/music/delete_album_review.html index 99936ba5..f804b1a6 100644 --- a/music/templates/music/delete_album_review.html +++ b/music/templates/music/delete_album_review.html @@ -46,7 +46,7 @@
              - {{ review.owner.username }} {% if mark %} diff --git a/music/templates/music/delete_song.html b/music/templates/music/delete_song.html index f398d797..443c1b97 100644 --- a/music/templates/music/delete_song.html +++ b/music/templates/music/delete_song.html @@ -55,7 +55,7 @@ {% if song.last_editor %}
              {% trans '最近编辑者:' %} - + {{ song.last_editor | default:"" }}
              diff --git a/music/templates/music/delete_song_review.html b/music/templates/music/delete_song_review.html index 96f14481..1f66154c 100644 --- a/music/templates/music/delete_song_review.html +++ b/music/templates/music/delete_song_review.html @@ -46,7 +46,7 @@
              - {{ review.owner.username }} {% if mark %} diff --git a/music/templates/music/song_detail.html b/music/templates/music/song_detail.html index 8dfa5fae..55c9df8c 100644 --- a/music/templates/music/song_detail.html +++ b/music/templates/music/song_detail.html @@ -118,7 +118,7 @@ {% if song.last_editor %} -
              {% trans '最近编辑者:' %}{{ song.last_editor | default:"" }}
              +
              {% trans '最近编辑者:' %}{{ song.last_editor | default:"" }}
              {% endif %}
              @@ -170,7 +170,7 @@
                {% for others_mark in mark_list %}
              • - {{ others_mark.owner.username }} + {{ others_mark.owner.username }} {{ others_mark.get_status_display }} {% if others_mark.rating %} @@ -199,7 +199,7 @@
                  {% for others_review in review_list %}
                • - {{ others_review.owner.username }} + {{ others_review.owner.username }} {% if others_review.visibility > 0 %} {% endif %} diff --git a/music/templates/music/song_mark_list.html b/music/templates/music/song_mark_list.html index f51712be..3096d384 100644 --- a/music/templates/music/song_mark_list.html +++ b/music/templates/music/song_mark_list.html @@ -40,7 +40,7 @@ {% for mark in marks %}
                • - {{ mark.owner.username }} {{ mark.get_status_display }} {% if mark.rating %} diff --git a/music/templates/music/song_review_detail.html b/music/templates/music/song_review_detail.html index a052dc87..d099b4e0 100644 --- a/music/templates/music/song_review_detail.html +++ b/music/templates/music/song_review_detail.html @@ -48,7 +48,7 @@
                  - {{ review.owner.username }} + {{ review.owner.username }} {% if mark %} diff --git a/music/templates/music/song_review_list.html b/music/templates/music/song_review_list.html index b0ec4cf8..87f8e0e3 100644 --- a/music/templates/music/song_review_list.html +++ b/music/templates/music/song_review_list.html @@ -40,7 +40,7 @@
                • - {{ review.owner.username }} + {{ review.owner.username }} {% if review.visibility > 0 %} {% endif %} diff --git a/users/templates/users/home.html b/users/templates/users/home.html index f89bc3a4..f7e430f4 100644 --- a/users/templates/users/home.html +++ b/users/templates/users/home.html @@ -873,9 +873,9 @@
                    {% for report in reports %}
                  • - {{ report.submit_user }}{% trans '举报了' %}{{ report.reported_user }}
                  • {% empty %} diff --git a/users/templates/users/manage_report.html b/users/templates/users/manage_report.html index 567cf367..42385f79 100644 --- a/users/templates/users/manage_report.html +++ b/users/templates/users/manage_report.html @@ -27,9 +27,9 @@ {% for report in reports %}
                    - {{ report.submit_user.username }} + {{ report.submit_user.username }} {% trans '举报了' %} - {{ report.reported_user.username }} + {{ report.reported_user.username }} @{{ report.submitted_time }} {% if report.image %} diff --git a/users/urls.py b/users/urls.py index eeb8cd06..bc49e374 100644 --- a/users/urls.py +++ b/users/urls.py @@ -18,14 +18,14 @@ urlpatterns = [ path('delete/', delete, name='delete'), path('layout/', set_layout, name='set_layout'), path('OAuth2_login/', OAuth2_login, name='OAuth2_login'), - path('/', home, name='home'), - path('/followers/', followers, name='followers'), - path('/following/', following, name='following'), - path('/collections/', collection_list, name='collection_list'), - path('/book//', book_list, name='book_list'), - path('/movie//', movie_list, name='movie_list'), - path('/music//', music_list, name='music_list'), - path('/game//', game_list, name='game_list'), + path('/', home_redirect, name='home_redirect'), + # path('/followers/', followers, name='followers'), + # path('/following/', following, name='following'), + # path('/collections/', collection_list, name='collection_list'), + # path('/book//', book_list, name='book_list'), + # path('/movie//', movie_list, name='movie_list'), + # path('/music//', music_list, name='music_list'), + # path('/game//', game_list, name='game_list'), path('/', home, name='home'), path('/followers/', followers, name='followers'), path('/following/', following, name='following'), diff --git a/users/views.py b/users/views.py index 7ee1e44e..6c5ba15c 100644 --- a/users/views.py +++ b/users/views.py @@ -228,6 +228,15 @@ def delete(request): raise NotImplementedError +def home_redirect(request, id): + try: + query_kwargs = {'pk': id} + user = User.objects.get(**query_kwargs) + return redirect(reverse("users:home", args=[user.mastodon_username])) + except Exception: + return redirect(settings.LOGIN_URL) + + def home_anonymous(request, id): login_url = settings.LOGIN_URL + "?next=" + request.get_full_path() try: @@ -950,7 +959,7 @@ def report(request): form.instance.is_read = False form.instance.submit_user = request.user form.save() - return redirect(reverse("users:home", args=[form.instance.reported_user.id])) + return redirect(reverse("users:home", args=[form.instance.reported_user.mastodon_username])) else: return render( request,