# Path: boilerplate/models.py
# class User(User):
# class LogVisit(ndb.Model):
# class LogEmail(ndb.Model):
# class SocialUser(ndb.Model):
#     def get_by_email(cls, email):
#     def create_resend_token(cls, user_id):
#     def validate_resend_token(cls, user_id, token):
#     def delete_resend_token(cls, user_id, token):
#     def get_social_providers_names(self):
#     def get_social_providers_info(self):
#     def get_by_user(cls, user):
#     def get_by_user_and_provider(cls, user, provider):
#     def get_by_provider_and_uid(cls, provider, uid):
#     def check_unique_uid(cls, provider, uid):
#     def check_unique_user(cls, provider, user):
#     def check_unique(cls, user, provider, uid):
#     def open_id_providers():
#     PROVIDERS_INFO = { # uri is for OpenID only (not OAuth)
#         'google': {'name': 'google', 'label': 'Google', 'uri': 'gmail.com'},
#         'github': {'name': 'github', 'label': 'Github', 'uri': ''},
#         'facebook': {'name': 'facebook', 'label': 'Facebook', 'uri': ''},
#         'linkedin': {'name': 'linkedin', 'label': 'LinkedIn', 'uri': ''},
#         'myopenid': {'name': 'myopenid', 'label': 'MyOpenid', 'uri': 'myopenid.com'},
#         'twitter': {'name': 'twitter', 'label': 'Twitter', 'uri': ''},
#         'yahoo': {'name': 'yahoo', 'label': 'Yahoo!', 'uri': 'yahoo.com'},
#     }
# 
# Path: boilerplate/handlers.py
# class AbTestHandler(BaseHandler):
# class LoginRequiredHandler(BaseHandler):
# class RegisterBaseHandler(BaseHandler):
# class SendEmailHandler(BaseHandler):
# class LoginHandler(BaseHandler):
# class SocialLoginHandler(BaseHandler):
# class CallbackSocialLoginHandler(BaseHandler):
# class DeleteSocialProviderHandler(BaseHandler):
# class LogoutHandler(BaseHandler):
# class RegisterHandler(RegisterBaseHandler):
# class AccountActivationHandler(BaseHandler):
# class ResendActivationEmailHandler(BaseHandler):
# class ContactHandler(BaseHandler):
# class EditProfileHandler(BaseHandler):
# class EditPasswordHandler(BaseHandler):
# class EditEmailHandler(BaseHandler):
# class PasswordResetHandler(BaseHandler):
# class PasswordResetCompleteHandler(BaseHandler):
# class EmailChangedCompleteHandler(BaseHandler):
#     def get(self):
#     def get(self):
#     def form(self):
#     def post(self):
#     def get(self):
#     def post(self):
#     def form(self):
#     def get(self, provider_name):
#     def get(self, provider_name):
#     def create_account_from_social_provider(self, provider_name, uid, email=None, continue_url=None, user_data=None):
#     def post(self, provider_name):
#     def get(self):
#     def get(self):
#     def post(self):
#     def get(self, user_id, token):
#     def get(self, user_id, token):
#     def get(self):
#     def post(self):
#     def form(self):
#     def get(self):
#     def post(self):
#     def form(self):
#     def get(self):
#     def post(self):
#     def form(self):
#     def get(self):
#     def post(self):
#     def form(self):
#     def get(self):
#     def post(self):
#     def get(self, user_id, token):
#     def post(self, user_id, token):
#     def form(self):
#     def get(self, user_id, encoded_email, token):


import webapp2
from boilerplate import models
from boilerplate import forms
from boilerplate.handlers import BaseHandler
from google.appengine.datastore.datastore_query import Cursor
from google.appengine.ext import ndb
from google.appengine.api import users as googleusers
from collections import OrderedDict, Counter
from wtforms import fields
            self.view.next_cursor = cursor.reversed()
 
        def pager_url(p, cursor):
            params = OrderedDict()
            if q:
                params['q'] = q
            if p in ['prev']:
                params['p'] = p
            if cursor:
                params['c'] = cursor.urlsafe()
            return self.uri_for('user-list', **params)

        self.view.pager_url = pager_url
        self.view.q = q
        
        params = {
            "list_columns": [('username', 'Username'),
                             ('last_name', 'Last Name'), 
                             ('email', 'E-Mail'),
                             ('country', 'Country')],
            "users" : users,
            "count" : qry.count()
        }

        # FIXME: admin_user should probably go into BaseHandler
        params['admin_user'] = googleusers.is_current_user_admin()
        
        return self.render_template('admin/users.html', **params)



# Path: boilerplate/models.py
# class User(User):
# class LogVisit(ndb.Model):
# class LogEmail(ndb.Model):
# class SocialUser(ndb.Model):
#     def get_by_email(cls, email):
#     def create_resend_token(cls, user_id):
#     def validate_resend_token(cls, user_id, token):
#     def delete_resend_token(cls, user_id, token):
#     def get_social_providers_names(self):
#     def get_social_providers_info(self):
#     def get_by_user(cls, user):
#     def get_by_user_and_provider(cls, user, provider):
#     def get_by_provider_and_uid(cls, provider, uid):
#     def check_unique_uid(cls, provider, uid):
#     def check_unique_user(cls, provider, user):
#     def check_unique(cls, user, provider, uid):
#     def open_id_providers():
#     PROVIDERS_INFO = { # uri is for OpenID only (not OAuth)
#         'google': {'name': 'google', 'label': 'Google', 'uri': 'gmail.com'},
#         'github': {'name': 'github', 'label': 'Github', 'uri': ''},
#         'facebook': {'name': 'facebook', 'label': 'Facebook', 'uri': ''},
#         'linkedin': {'name': 'linkedin', 'label': 'LinkedIn', 'uri': ''},
#         'myopenid': {'name': 'myopenid', 'label': 'MyOpenid', 'uri': 'myopenid.com'},
#         'twitter': {'name': 'twitter', 'label': 'Twitter', 'uri': ''},
#         'yahoo': {'name': 'yahoo', 'label': 'Yahoo!', 'uri': 'yahoo.com'},
#     }
# 
# Path: boilerplate/handlers.py
# class AbTestHandler(BaseHandler):
# class LoginRequiredHandler(BaseHandler):
# class RegisterBaseHandler(BaseHandler):
# class SendEmailHandler(BaseHandler):
# class LoginHandler(BaseHandler):
# class SocialLoginHandler(BaseHandler):
# class CallbackSocialLoginHandler(BaseHandler):
# class DeleteSocialProviderHandler(BaseHandler):
# class LogoutHandler(BaseHandler):
# class RegisterHandler(RegisterBaseHandler):
# class AccountActivationHandler(BaseHandler):
# class ResendActivationEmailHandler(BaseHandler):
# class ContactHandler(BaseHandler):
# class EditProfileHandler(BaseHandler):
# class EditPasswordHandler(BaseHandler):
# class EditEmailHandler(BaseHandler):
# class PasswordResetHandler(BaseHandler):
# class PasswordResetCompleteHandler(BaseHandler):
# class EmailChangedCompleteHandler(BaseHandler):
#     def get(self):
#     def get(self):
#     def form(self):
#     def post(self):
#     def get(self):
#     def post(self):
#     def form(self):
#     def get(self, provider_name):
#     def get(self, provider_name):
#     def create_account_from_social_provider(self, provider_name, uid, email=None, continue_url=None, user_data=None):
#     def post(self, provider_name):
#     def get(self):
#     def get(self):
#     def post(self):
#     def get(self, user_id, token):
#     def get(self, user_id, token):
#     def get(self):
#     def post(self):
#     def form(self):
#     def get(self):
#     def post(self):
#     def form(self):
#     def get(self):
#     def post(self):
#     def form(self):
#     def get(self):
#     def post(self):
#     def form(self):
#     def get(self):
#     def post(self):
#     def get(self, user_id, token):
#     def post(self, user_id, token):
#     def form(self):
#     def get(self, user_id, encoded_email, token):


# Path: admin/users.py
import webapp2
from boilerplate import models
from boilerplate import forms
from boilerplate.handlers import BaseHandler
from google.appengine.datastore.datastore_query import Cursor
from google.appengine.ext import ndb
from google.appengine.api import users as googleusers
from collections import OrderedDict, Counter
from wtforms import fields

            self.view.next_cursor = cursor.reversed()
 
        def pager_url(p, cursor):
            params = OrderedDict()
            if q:
                params['q'] = q
            if p in ['prev']:
                params['p'] = p
            if cursor:
                params['c'] = cursor.urlsafe()
            return self.uri_for('user-list', **params)

        self.view.pager_url = pager_url
        self.view.q = q
        
        params = {
            "list_columns": [('username', 'Username'),
                             ('last_name', 'Last Name'), 
                             ('email', 'E-Mail'),
                             ('country', 'Country')],
            "users" : users,
            "count" : qry.count()
        }

        # FIXME: admin_user should probably go into BaseHandler
        params['admin_user'] = googleusers.is_current_user_admin()
        
        return self.render_template('admin/users.html', **params)



class Edit(BaseHandler):