Commit 9fbad193 by liuyingying

一上午都没搞完一个

parent 777382f8
...@@ -43,6 +43,7 @@ class Publications(models.Model): ...@@ -43,6 +43,7 @@ class Publications(models.Model):
class PubToUser(models.Model): class PubToUser(models.Model):
pubID = models.BigIntegerField() pubID = models.BigIntegerField()
username = models.CharField(max_length=50) username = models.CharField(max_length=50)
userID = models.IntegerField(default=0)
class Articles(models.Model): class Articles(models.Model):
......
/**
* Simplified Chinese translation for bootstrap-datetimepicker
* Yuan Cheung <advanimal@gmail.com>
*/
;(function($){
$.fn.datetimepicker.dates['zh-CN'] = {
days: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"],
daysShort: ["周日", "周一", "周二", "周三", "周四", "周五", "周六", "周日"],
daysMin: ["日", "一", "二", "三", "四", "五", "六", "日"],
months: ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"],
monthsShort: ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"],
today: "今天",
suffix: [],
meridiem: ["上午", "下午"]
};
}(jQuery));
...@@ -656,8 +656,13 @@ section > .smaller_box{ ...@@ -656,8 +656,13 @@ section > .smaller_box{
li svg{ li svg{
margin:10px 5px; margin:10px 5px;
} }
.right button, .li_right button{
background: transparent; .dele_img{
width: 20px;
height: 20px;
margin: 5px 0;
background-image: url("/static/hunter/images/delete.png");
} }
.add_one button svg{ .add_one button svg{
margin:8px 5px; margin:8px 5px;
......
...@@ -17,11 +17,12 @@ ...@@ -17,11 +17,12 @@
<span>{{ user.mailAddress }} </span> <span>{{ user.mailAddress }} </span>
{% endif %} {% endif %}
{% if user.personal_website %} {% if user.personal_website %}
<a href="{{ user.personal_website }}" target="_blank">{{ user.personal_website }}</a> <a href="javascript:goUrl({{ user.personal_website }})" target="_blank">{{ user.personal_website }}</a>
{% endif %} {% endif %}
</div> </div>
</div> </div>
<div class="wrap"> <div class="wrap">
{% if publications %}
<div class="section"> <div class="section">
<span>PUBLICATIONS</span> <span>PUBLICATIONS</span>
{% for year,publications in publication_year_list.items %} {% for year,publications in publication_year_list.items %}
...@@ -31,7 +32,6 @@ ...@@ -31,7 +32,6 @@
{{ year }} {{ year }}
</span> </span>
</div> </div>
{% if publications %}
{% for publication in publications %} {% for publication in publications %}
<ul> <ul>
<li> <li>
...@@ -45,10 +45,10 @@ ...@@ -45,10 +45,10 @@
</li> </li>
</ul> </ul>
{% endfor %} {% endfor %}
{% endif %}
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
{% endif %}
{% if cve_year_list.items %} {% if cve_year_list.items %}
<div class="section"> <div class="section">
<span>MY-CVE</span> <span>MY-CVE</span>
...@@ -79,5 +79,10 @@ ...@@ -79,5 +79,10 @@
{% endif %} {% endif %}
</div> </div>
</div> </div>
<script>
function goUrl(url){
window.open(url);
}
</script>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -149,7 +149,7 @@ def user(request, user_id): ...@@ -149,7 +149,7 @@ def user(request, user_id):
username = usr.name username = usr.name
u = {'userID': user_id, 'name': username} u = {'userID': user_id, 'name': username}
my_publication_year_list = {} my_publication_year_list = {}
pub_ids = PubToUser.objects.filter(username=username).all().values("pubID") pub_ids = PubToUser.objects.filter(userID=user_id).all().values("pubID")
for pub_id in pub_ids: for pub_id in pub_ids:
print(pub_id) print(pub_id)
pub = get_object_or_404(Publications, pk=pub_id['pubID']) pub = get_object_or_404(Publications, pk=pub_id['pubID'])
...@@ -195,7 +195,7 @@ def detail(request, user_id): ...@@ -195,7 +195,7 @@ def detail(request, user_id):
usr = get_object_or_404(User, pk=user_id) usr = get_object_or_404(User, pk=user_id)
username = usr.name username = usr.name
my_publication_year_list = {} my_publication_year_list = {}
pub_ids = PubToUser.objects.filter(username=username).all().values("pubID") pub_ids = PubToUser.objects.filter(userID=user_id).all().values("pubID")
for pub_id in pub_ids: for pub_id in pub_ids:
pub = get_object_or_404(Publications, pk=pub_id['pubID']) pub = get_object_or_404(Publications, pk=pub_id['pubID'])
year = str(pub.date)[0:4] year = str(pub.date)[0:4]
...@@ -228,7 +228,7 @@ def detail(request, user_id): ...@@ -228,7 +228,7 @@ def detail(request, user_id):
my_article_year_list[year] = [art] my_article_year_list[year] = [art]
context = { context = {
'user': usr, 'user': usr,
'art_year_list':my_article_year_list, 'art_year_list': my_article_year_list,
'publication_year_list': my_publication_year_list, 'publication_year_list': my_publication_year_list,
'cve_year_list': my_cve_year_list, 'cve_year_list': my_cve_year_list,
} }
...@@ -376,11 +376,43 @@ def add_publication(request): ...@@ -376,11 +376,43 @@ def add_publication(request):
authorArr = authors.split(',') authorArr = authors.split(',')
print(authorArr) print(authorArr)
for author in authorArr: for author in authorArr:
try: users_list = User.objects.all().values('name')
PubToUser.objects.create(pubID = pubID,username=author) user_list=[]
response = JsonResponse({"message": 1, 'pubID':pubID}) for user in users_list:
except ProgrammingError as e: user_list.append(user['name'])
return JsonResponse({"message": 0}) author = str(author).lower().strip()
if ' ' in author:
author_version1 = author.replace(' ','')
author_version2 = author.split(' ')[1]+str(author).lower().strip().split(' ')[0]
else:
author_version1 = author.replace(' ', '')
author_version2 = author
print(user_list)
print(author_version1)
print(author_version2)
if author_version1 in user_list:
userID = User.objects.filter(name=author_version1).values('userID')[0]['userID']
try:
print("测试:LIU Yingying")
PubToUser.objects.create(pubID = pubID,username=author, userID=userID)
response = JsonResponse({"message": 1, 'pubID':pubID})
except ProgrammingError as e:
return JsonResponse({"message": 0})
else:
if author_version2 in user_list:
print("测试:Yingying LIU")
userID = User.objects.filter(name=author_version2).values('userID')[0]['userID']
try:
PubToUser.objects.create(pubID = pubID,username=author, userID=userID)
response = JsonResponse({"message": 1, 'pubID':pubID})
except ProgrammingError as e:
return JsonResponse({"message": 0})
else:
try:
PubToUser.objects.create(pubID = pubID,username=author)
response = JsonResponse({"message": 1, 'pubID':pubID})
except ProgrammingError as e:
return JsonResponse({"message": 0})
# message["warning"] = "上传成功" # message["warning"] = "上传成功"
# return HttpResponse(json.dumps(message), content_type='application/json') # return HttpResponse(json.dumps(message), content_type='application/json')
return response return response
......
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