From 8d4d7669f41c2db878c27f8a8c9b1525826a54d0 Mon Sep 17 00:00:00 2001 From: syk1209wwz0306 <3228195956@qq.com> Date: Thu, 30 May 2024 16:29:04 +0800 Subject: [PATCH] commit0530 --- .../movie/__pycache__/tests.cpython-38.pyc | Bin 0 -> 196 bytes .../movie/__pycache__/urls.cpython-38.pyc | Bin 464 -> 430 bytes .../movie/__pycache__/views.cpython-38.pyc | Bin 3449 -> 3023 bytes MoviesRecommend/movie/urls.py | 2 - MoviesRecommend/movie/views.py | 11 +- MoviesRecommend/templates/movie/base.html | 40 ++++-- MoviesRecommend/templates/movie/detail.html | 5 +- MoviesRecommend/templates/movie/index.html | 119 ++++++++++-------- MoviesRecommend/templates/movie/tag.html | 114 ----------------- 9 files changed, 100 insertions(+), 191 deletions(-) create mode 100644 MoviesRecommend/movie/__pycache__/tests.cpython-38.pyc delete mode 100644 MoviesRecommend/templates/movie/tag.html diff --git a/MoviesRecommend/movie/__pycache__/tests.cpython-38.pyc b/MoviesRecommend/movie/__pycache__/tests.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..64d0d5eaaecb1d0b46cdbeb22f55045eb1b7b04d GIT binary patch literal 196 zcmWIL<>g`kf(6g-#n}Mq#~=ypCBrl$V!_0SH92BGPgg85kaeILLq<$Z-JT;;4z*c8Z)S?7hsXj452H%vl@@ z*cLLRaDhb9nWH#UxPuuqc_z*=o_Ix>k!#`)>&Z5ZI&AzvtwsEk^B4mJcz{eECLSgh LRv~5~CZV4Iao-l& delta 160 zcmZ3-e1Tazl$V!_0SGdVhox<0WMFs<;vfSKAjbiSi*qJw+Zl7Du=g^jGNy2*GG}ot zU|YzL!UYxK28wWkMYusC=`2xPDLlapn!FRcj9G6nmn5c7+^fvUJ@KJ6D|<*{de~$M hMgukhput4~ll>S2g!q6=9wr_p7FHo9A!Z={4glgCAI|^) diff --git a/MoviesRecommend/movie/__pycache__/views.cpython-38.pyc b/MoviesRecommend/movie/__pycache__/views.cpython-38.pyc index ca7a7f030a9cf0472862a24cdee12dbd525e5f96..322c5688e2b7ec43d868048c7f3121f3d01f0826 100644 GIT binary patch delta 213 zcmewN@W4^g;E%U z88o>!?m5IdS&*Yw!V0L(5{Qf0fCL943nL3t5lCz@FQe4v3mh_xjGmLw3+P4t0uq$6yRVKVU%DLVHPkF-~<4z+9(qM delta 508 zcmYL^O-lk%6o%)_jLwInO*&?jeL;m6!Ga(tkgTAfphX`p+=wufB$aeWi^PbiWiH~< zqD7F)Ac*K6v~1JfW&fgG=SbmP?sM)r=f3Zp`<3_^itL5Mri9=3XMVqG-$jyedzao% ztJg}Qe_e77*SwKj(+gl8#XRI%m|Gt8V=nASEd2KJ5in)6$l>-=BBQZEtm_?Zw^Ys_ zcxR2sQT6n|o2iw`;$F*Kj^n+iRFR&*g*IG3O|B>vwF$1=f~SD1w8>W8>Ztx#miI608A2dp*F~Tx|Z1}2RMiTPxYlZ?)6dUIAB&jxW`}E?!|I-Yzu11Zn eCv!w1bQPpo_>y=CO-Cc$s}2l;qu4XHWgEZIT3vMj diff --git a/MoviesRecommend/movie/urls.py b/MoviesRecommend/movie/urls.py index 5126bc6..3b82959 100644 --- a/MoviesRecommend/movie/urls.py +++ b/MoviesRecommend/movie/urls.py @@ -8,8 +8,6 @@ app_name = 'movie' urlpatterns = [ # 默认首页 path('', views.IndexView.as_view(), name='index'), - # 分类查看 - path('tag', views.TagView.as_view(), name='tag'), # 电影详情页面 path('detail/', views.MovieDetailView.as_view(), name='detail'), diff --git a/MoviesRecommend/movie/views.py b/MoviesRecommend/movie/views.py index 26def37..515e6cf 100644 --- a/MoviesRecommend/movie/views.py +++ b/MoviesRecommend/movie/views.py @@ -50,17 +50,8 @@ class IndexView(ListView): 'right_has_more': right_has_more } -# 电影分类视图 -class TagView(ListView): - model = Movie - template_name = 'movie/tag.html' - paginate_by = 15 - context_object_name = 'movies' - page_kwarg = 'p' - def get_queryset(self): - tag_slug = self.kwargs.get('slug') # 假设URL中传入了分类的slug - return Movie.objects.filter(tag=tag_slug).order_by('id') + # 电影详情视图 class MovieDetailView(DetailView): diff --git a/MoviesRecommend/templates/movie/base.html b/MoviesRecommend/templates/movie/base.html index 4b80a8b..6b59940 100644 --- a/MoviesRecommend/templates/movie/base.html +++ b/MoviesRecommend/templates/movie/base.html @@ -11,8 +11,34 @@ - + + + + {% block content %}
@@ -33,21 +59,13 @@
{% endfor %}
- + {% endblock %} -
-
-

- Copyright (C). create by BHML 2023, All Rights Reserved   - -

-
-
- + \ No newline at end of file diff --git a/MoviesRecommend/templates/movie/detail.html b/MoviesRecommend/templates/movie/detail.html index c96ad9c..299dd49 100644 --- a/MoviesRecommend/templates/movie/detail.html +++ b/MoviesRecommend/templates/movie/detail.html @@ -29,10 +29,7 @@

编剧:{{ movie.writers }}

主演:{{ movie.actors }}

- 类型: - {% for genre in movie.get_genre %} - {{ genre }}{% if not forloop.last %} | {% endif %} - {% endfor %} +

时长:{{ movie.time }}

发行时间:{{ movie.release_time }}

diff --git a/MoviesRecommend/templates/movie/index.html b/MoviesRecommend/templates/movie/index.html index 61f91ab..49e8deb 100644 --- a/MoviesRecommend/templates/movie/index.html +++ b/MoviesRecommend/templates/movie/index.html @@ -1,66 +1,85 @@ {% extends "movie/base.html" %} -{% load static %} {% block content %} - -
-
-

项目简介

-

电影推荐系统

- + .item .poster_div { + height: 320px; + overflow: hidden; + } + +
+
+

项目简介

+

数据集:本系统使用最新的movielens数据集版本ml-latest-small该数据集,该数据集包含9742部电影、 + 610个用户、100837个评分。有 links.csv (电影的imdbid和tmdbid)、 movies.csv (电影详情)、 ratings.csv (电影评分数据集 )等数据。 +

+

系统首页会展示部分电影,热门电影会展示评分最高的前100部电影,你可以点击任意一部电影查看详情

+

你可以给电影评分(需登录),查看网站对你的推荐(基于用户的协同过滤算法)

+

使用分类或搜索功能可以帮助你找到电影

+
-
+ +
-
- - {% for movie in movies %} + {% for movie in movies %}

{{ movie.name }} - {{ movie.get_score }} +

{% endfor %} - -
+
- - + + {% endblock %} \ No newline at end of file diff --git a/MoviesRecommend/templates/movie/tag.html b/MoviesRecommend/templates/movie/tag.html deleted file mode 100644 index 38d74ce..0000000 --- a/MoviesRecommend/templates/movie/tag.html +++ /dev/null @@ -1,114 +0,0 @@ -{% extends 'movie/base.html' %} -{% block content %} - -
- - {% if genre %} - - {% endif %} - -
- -
- {% for movie in movies %} - -
- -

{{ movie.name }} - {{ movie.get_score }} -

- -
-
- {% endfor %} -
- - -{% endblock %} \ No newline at end of file