From c6da3a9c65a46f64684a2bef6380b8c59fd927a3 Mon Sep 17 00:00:00 2001 From: gothack329 Date: Sat, 10 Mar 2018 19:17:59 +0800 Subject: [PATCH] fix bugs --- article/__pycache__/models.cpython-36.pyc | Bin 4706 -> 4713 bytes article/__pycache__/views.cpython-36.pyc | Bin 2496 -> 2606 bytes article/models.py | 4 +-- article/templates/article/detail.html | 13 ++++---- article/templates/article/publish.html | 2 +- article/views.py | 18 ++++++---- db.sqlite3 | Bin 368640 -> 380928 bytes edconline/__pycache__/views.cpython-36.pyc | Bin 1236 -> 1450 bytes edconline/views.py | 8 ++++- .../__pycache__/models.cpython-36.pyc | Bin 1772 -> 1847 bytes notification/models.py | 3 ++ static/avatar/WechatIMG473.jpeg | Bin 0 -> 5317 bytes static/avatar/WechatIMG473_UKHFrnB.jpeg | Bin 0 -> 5317 bytes static/image/favicon.ico | Bin 0 -> 4286 bytes static/upload/canon_in_d_3.jpg | Bin 0 -> 94124 bytes templates/base.html | 11 +++++-- templates/index.html | 28 ++++++++++++++++ userpage/__pycache__/admin.cpython-36.pyc | Bin 802 -> 814 bytes userpage/__pycache__/models.cpython-36.pyc | Bin 3753 -> 3885 bytes userpage/__pycache__/views.cpython-36.pyc | Bin 4148 -> 4364 bytes userpage/admin.py | 2 +- userpage/models.py | 6 ++-- userpage/templates/userpage/change.html | 7 ++-- userpage/templates/userpage/login.html | 7 ++-- userpage/templates/userpage/profile.html | 16 ++++++--- userpage/views.py | 31 ++++++++++++------ 26 files changed, 114 insertions(+), 42 deletions(-) create mode 100644 static/avatar/WechatIMG473.jpeg create mode 100644 static/avatar/WechatIMG473_UKHFrnB.jpeg create mode 100644 static/image/favicon.ico create mode 100644 static/upload/canon_in_d_3.jpg diff --git a/article/__pycache__/models.cpython-36.pyc b/article/__pycache__/models.cpython-36.pyc index 4db144017035730fc32fdc09fffdc33ef8d48fd9..e7bcdd76a580de6f1dcd9e83879da7a5a2f2153e 100644 GIT binary patch delta 71 zcmV-N0J#6+BW#wgq}yqX|munul%seK_B8CgLH^b=VVsa>5SnG1 zG2M~{>W9ZUjJo6mZx9Tt=Pq8Fnvpw3YP}nayAX~e1Oh$CP9dB|P!VDXVT3aX)ps!Y zSxk&01mgw|(F>tZ%X|pa!+&7}*%$zlQWHFCyV*>~R%fc!!4EJw0cwnJp|Nlv^WY78Py_J*XLpou4#4s@k3 z-w4OTa;#yFXp$4IaE+@pb*Off0?McFiT5Nos&3yeJjmm~ELR(Tv08Gatu`AjV-bXq zP?g*9z$(=$6}RfUG_SCfC@GWTCm9xRl@)wW{8E-i0%yG!u~}mkHXsuN^&!+qL5(}= zMYU0U?uut>M!Z%h^l|BB!{U>g-5LRN6c9Scq_un8j_vB8WUtPW5HT$g=*6bLUt@vO ztka_J)@$Xe{{gW@5!Y7dXJiC2VmOUeV&fQ2Dlu&12sY&>NmQI9Nt{+pk{}WJZYykA zywVOZ5&yJD^B_Er!)BZEOv@|FNcM%sKI0pKM=%M`w-s z<+VK@fiiX(a0PG`kO!OxrtkH*)`sUwT7J}usvRy(YGOQz%#Yy#3x)WW!I z6#ymJ8sM}c!wF6kul2;oAu*I4HVdaX(i}$&L{% ifnotequal user.unread 0%} ({{user.unread}}) {% endifnotequal %} 物志 › {{art.title}} +{% block title %} + - {{art.title}} +{% endblock %} + +{% block header %} + + {% if user.id %} + {% ifnotequal user.unread 0 %} ({{user.unread}}) {% endifnotequal %} + {% endif %} + 物志 {%block title%} {% endblock %} + {% block header %} - {% ifnotequal user.unread 0%} ({{user.unread}}) {% endifnotequal %} 物志 {% if title %}› {{title}} {% endif %} + {% endblock %} diff --git a/templates/index.html b/templates/index.html index 04fcedb..f597388 100644 --- a/templates/index.html +++ b/templates/index.html @@ -50,5 +50,33 @@

{% if title %}{{title}}{% endif %}

{% endfor %} + + + + {% endblock %} + \ No newline at end of file diff --git a/userpage/__pycache__/admin.cpython-36.pyc b/userpage/__pycache__/admin.cpython-36.pyc index 7a66c044b4ed58314ea581142fbd974f37b66a39..33af3ff276636afb278c61a62794c233b9961ea7 100644 GIT binary patch delta 226 zcmZ3)wvLU{n3tC;u55ACriq+$@J2DG@B}kx@=ZLV z#>QHZpP5%O@udqR_hdarBc>vO$+3)9Y@$F7MWU1EGH&#e05K&&gcOj_WGNB^v4uc{ zFo+NV5fJromKca74kWmMxR?n@a4;5$PoBZ#X9E(w#To#z6`QVG95%W6DWy57c8nmc PApJay9Lz#Yd_W8UNq;9m delta 171 zcmZ3-wup_>n3tF9GS}RwRTDYqFmg>|66NHHVou=>X3*rFctmaDM`uQ^$)=1(lXDo& z*+du^7>YzDuVmclB@SXrfCxz-p~+Gt0AdS*2q6$53?d-v;Ve-QOAJVG0dX-CklRx5~X6*a!8Y)~VUrC<%M zG(8B#(`$S3){7oW)E@jB1pk8EN;6YEq6CT^j0SP_?rviFUxN;!}GU5L-LwM@O9^{u;x$q_o7j)xQvZJ0f z^zL|7rJFe9KEzw+5C`2dR^1!!V9}c`mLP=uiHLL12ZawT4k4li19;#)8nBbS*Ga1W z&S2P8|gxmMBY9_`oVak-u0O zDDV%fk)09okg`Odbf80rfG`3eNJJB@c)(KP+*A0#o`WjCvA0ZB1ca)<>ipf#TUFuM zzC?|$I~k`UWRD6E%9_0G9IfpM{id{o{%;ps5|$Mu8Umii{u&NsTI1i&a&lM5o-QE2 ba>cL~&rLm8b$O*J(c)iLnyay_qNUUy77Ah3 diff --git a/userpage/__pycache__/views.cpython-36.pyc b/userpage/__pycache__/views.cpython-36.pyc index 3e59901e94ef0ed4e74861808bf698e292a30888..6d10684ee66c37345fac96da5fe4c11eea5b96b9 100644 GIT binary patch delta 1225 zcmZ8g&1)M+6rVTyHQL!-OR{1|Zqo!4N(3>bX$W;`L!3B-wqPhu$p@*0@d#I|R#HYI z)52_Z*lXMt=Gs$pDHICDIrrS23OOo&K`uG<56F9~QqoAwZ{EDGo%h~vo}7EM9>15S z@x~92@Bh~RJsxm4a!33w?76@BpXV(v0hnp$kO!74ehm4F%1S7tIc;TSTXVm9XJGB* zFRuachI{6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2Ou0lzFj85GydQ&um51a7- z1OBaKzmUPm`bxk56sOT_Jz43tpF diff --git a/userpage/admin.py b/userpage/admin.py index 6c82e51..53f57f6 100644 --- a/userpage/admin.py +++ b/userpage/admin.py @@ -3,7 +3,7 @@ # Register your models here. class ProfileAdmin(admin.ModelAdmin): - list_display = ('user','address','avatar','invite_code','mobile','wechat','weibo','facebook','twitter','instagram') + list_display = ('user','address','avatar','point','invite_code','mobile','wechat','weibo','facebook','twitter','instagram') admin.site.register(Profile,ProfileAdmin) diff --git a/userpage/models.py b/userpage/models.py index 6af5aa4..180ae05 100644 --- a/userpage/models.py +++ b/userpage/models.py @@ -43,7 +43,7 @@ class Meta: class ProfileForm(ModelForm): class Meta: model = Profile - fields = ('avatar',) + fields = ('avatar','mobile','weibo','wechat','facebook','twitter','instagram','telegram') error_messages = { 'avatar':{'required': '请上传头像'}, } @@ -64,7 +64,7 @@ class Point(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) point_record = models.IntegerField() record_time = models.DateTimeField(auto_now_add=True,editable=False) - event = models.CharField(choices=(('publish','发布文章'),('comment','发表评论'),('commented','文章被评论'),('register','新用户注册')),max_length=16) + event = models.CharField(choices=(('invite','邀请新用户'),('publish','发布文章'),('comment','发表评论'),('commented','文章被评论'),('register','新用户注册')),max_length=16) def __str__(self): return '%s %s %d' % (self.user,self.event,self.point_record) @@ -72,6 +72,7 @@ def __str__(self): @receiver(post_save, sender=User) def create_user_profile(sender, instance, created, **kwargs): + print(instance) if created: Profile.objects.create(user=instance) @@ -85,3 +86,4 @@ def update_user_point(sender, instance, created, **kwargs): user = Profile.objects.get(user=instance.user) user.point += instance.point_record user.save() + diff --git a/userpage/templates/userpage/change.html b/userpage/templates/userpage/change.html index bc1993f..ad1c052 100644 --- a/userpage/templates/userpage/change.html +++ b/userpage/templates/userpage/change.html @@ -1,10 +1,8 @@ {% extends 'base.html' %} {% load timetonow %} -{% block header %} - 物志 › {{request.user}} - - +{% block title %} +› {{request.user}} {% endblock %} {% block banner %} @@ -19,6 +17,7 @@ 物志 › 修改密码
{{change_form.as_p}} +

返回

diff --git a/userpage/templates/userpage/login.html b/userpage/templates/userpage/login.html index 1d665d6..55fe4b6 100644 --- a/userpage/templates/userpage/login.html +++ b/userpage/templates/userpage/login.html @@ -1,8 +1,8 @@ {% extends 'base.html' %} {% load timetonow %} -{% block header %} - 物志 › 登录 +{% block title %} + › 登录 {% endblock %} {% block banner %} @@ -28,7 +28,8 @@

-

+ +

diff --git a/userpage/templates/userpage/profile.html b/userpage/templates/userpage/profile.html index 803fec4..b49eec2 100644 --- a/userpage/templates/userpage/profile.html +++ b/userpage/templates/userpage/profile.html @@ -2,8 +2,12 @@ {% load timetonow %} {% load displayName %} +{% block title %} + › {{request.user}} +{% endblock %} + {% block header %} - {% ifnotequal user.unread 0%} ({{user.unread}}) {% endifnotequal %} 物志 › {{request.user}} +