def rename_usergroup_site(): for group in UserGroup.all(): site = Site(name=group.name.replace(' - User Group', ''), users=group.users, admins=group.admins) site.put() for style in group.style_set: style.site = site style.put()
def get(self): account = self.getAccountfromPath() logging.info('getAccountfromPath = %s' % (account)) try: user = User.all().filter('account ==', account)[0] except: user = False logging.info('user = %s' % (user)) usergroup = user.UserGroup_key.key().id_or_name() grouphtml = '' for g in UserGroup.all().order('GroupName'): if usergroup == g.key().id_or_name(): grouphtml += '<option selected value="%s">%s</option>' % ( g.key().id_or_name(), g.GroupName) + '\n' else: grouphtml += '<option value="%s">%s</option>' % ( g.key().id_or_name(), g.GroupName) + '\n' grouphtml = '<select name="group" size="1">' + grouphtml + '</select>' xonload = 'fonLoad();' if user: template_values = { 'xonload': xonload, 'id': user.key().id_or_name(), 'user': user, 'grouphtml': grouphtml, } else: template_values = {} path = os.path.join(os.path.dirname(__file__), 'templates/user.html') self.response.out.write(template.render(path, template_values))
def deleteMenuAndUserGroup(): try: for m in MenuMenuLink.all(): m.delete() except: pass try: for m in Menu.all(): m.delete() except: pass try: for m in UserGroup.all(): m.delete() except: pass