Skip to content

Commit

Permalink
合并分类标签管理,未测试
Browse files Browse the repository at this point in the history
  • Loading branch information
lihy0 committed Dec 15, 2022
1 parent 28be44c commit d8d8b3a
Show file tree
Hide file tree
Showing 48 changed files with 9,756 additions and 0 deletions.
15 changes: 15 additions & 0 deletions templates/theme/bage.html
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,21 @@

{% module widget_menu() %}

<li>

<a href="/dataset/list" title="数据集列表">Dataset List</a>

</li>
{# <li>#}
{##}
{# <a href="/download/" title="下载数据">下载数据</a>#}
{##}
{# </li>#}
{# <li>#}
{##}
{# <a href="/dataset/_add/" title="添加数据">添加数据</a>#}
{##}
{# </li>#}

<li class="dropdown">
<a href="" class="dropdown-toggle" data-toggle="dropdown">{{ _('User') }}
Expand Down
33 changes: 33 additions & 0 deletions torcms/model/category_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,39 @@ def get_kind(tagid):

return None

@staticmethod
def get_by_name(name, kind):
'''
根据Name得到类别实例
'''
if name:
rec = TabTag.select().where((TabTag.kind == kind) & (TabTag.name == name))
return rec.get()
return False

@staticmethod
def get_by_info(post_id, catalog_id):
'''
Geo the record by post and catalog.
'''
recs = TabPost2Tag.select().where((TabPost2Tag.post_id == post_id)
& (TabPost2Tag.tag_id == catalog_id))

if recs.count() == 1:
return recs.get()
elif recs.count() > 1:
# return the first one, and delete others.
out_rec = None
for rec in recs:
if out_rec:
entry = TabPost2Tag.delete().where(
TabPost2Tag.uid == rec.uid)
entry.execute()
else:
out_rec = rec
return out_rec
return None

# Deprived
@staticmethod
def get_qian2(qian2):
Expand Down
1 change: 1 addition & 0 deletions torcms_taginfo/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# -*- coding:utf-8 -*-
Binary file not shown.
Loading

0 comments on commit d8d8b3a

Please sign in to comment.