示例#1
0
文件: api.py 项目: araddon/demisauce
 def action_get_object(self,id, data_dict = {}):
     if type(id) == int:
         self.object = Group.get(site_id=self.site.id,id=id) 
     else:
         self.object = Group.by_slug(site_id=self.site.id,slug=id)  
     if self.object:
         self.qry = [self.object]
     else:
         log.error("no Group %s" % self.id)
示例#2
0
 def popup_post(self,id=''):
     g = None
     form = GroupForm(QueryDict(self.request.arguments))
     if form and form.validate():
         if 'id' in self.request.arguments and self.get_argument("id") != '0':
             g = Group.get(self.user.site_id,int(self.get_argument("id")))
             g.name = form.name.data
         else:
             g = Group(site_id=self.user.site_id,name=form.name.data)
         
         newtogroup, newtosite = g.add_memberlist(form.members.data)
         g.save()
     #return 'newtogroup= %s,  \n newtosite=%s' % (newtogroup, newtosite)
     self.popup_view(g.id)
示例#3
0
 def edit(self,id=0):
     item = Group.get(self.user.site_id,id)
     if not item or not item.site_id == self.user.site_id:
         item = None
     log.debug(item.members)
     for m in item.members:
         log.debug(m)
     self.render('/user/group.html',action='edit',item=item)
示例#4
0
 def viewlist(self,id=0):
     item = None
     groups = Group.by_site(self.user.site_id)
     temp = """
     filter = 'all'
     if 'filter' in request.params:
         filter = request.params['filter']
     page = 1
     if 'page' in request.params:
         page = int(request.params['page'])
     c.groups = webhelpers.paginate.Page(
             Group.by_site(self.user.site_id),
             page=page,items_per_page=5)
             
     ${h.dspager(c.groups)}
     groups = h.dspager(groups)
     """
     
     
     self.render('/user/group.html',action='list',groups=groups)
示例#5
0
 def popup_view(self,id=0):
     item = Group.get(self.user.site_id,id)
     if not item.site_id == self.user.site_id:
         item = None
     self.render('/user/group_popup.html',action='view',item=item)