Exemple #1
0
 def create_link(id_link, post_data):
     '''
     Add record in link.
     :param id_link:
     :param post_data:
     :return:
     '''
     if MLink.get_by_uid(id_link):
         return False
     TabLink.create(name=post_data['name'],
                    link=post_data['link'],
                    order=post_data['order'],
                    logo=post_data['logo'] if 'logo' in post_data else '',
                    uid=id_link)
     return id_link
Exemple #2
0
 def create_link(id_link, post_data):
     '''
     Add record in link.
     '''
     if MLink.get_by_uid(id_link):
         return False
     try:
         the_order = int(post_data['order'])
     except:
         the_order = 999
     TabLink.create(name=post_data['name'],
                    link=post_data['link'],
                    order=the_order,
                    logo=post_data['logo'] if 'logo' in post_data else '',
                    uid=id_link)
     return id_link
Exemple #3
0
 def query_all(limit_num=50):
     '''
     Return some of the records. Not all.
     :param limit_num:
     :return:
     '''
     return TabLink.select().limit(limit_num)
Exemple #4
0
 def update(uid, post_data):
     '''
     Updat the link.
     '''
     entry = TabLink.update(
         name=post_data['name'],
         link=post_data['link'],
         order=post_data['order'],
         logo=post_data['logo'] if 'logo' in post_data else '',
     ).where(TabLink.uid == uid)
     try:
         entry.execute()
         return True
     except:
         return False
Exemple #5
0
 def query_link(num):
     return TabLink.select().limit(num).order_by(TabLink.order)
Exemple #6
0
 def get_counts():
     '''
     The count in table.
     '''
     return TabLink.select().count()
Exemple #7
0
 def get_counts():
     '''
     The count in table.
     '''
     # adding ``None`` to hide ``No value for argument 'database' in method call``
     return TabLink.select().count(None)