From 7b65d64275d376504c5ebaab58e44974fe69cafe Mon Sep 17 00:00:00 2001
From: rjzhao1 <44123617+rjzhao1@users.noreply.github.com>
Date: Fri, 19 Oct 2018 01:40:07 -0700
Subject: [PATCH 01/35] Update db.py
---
models/db.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/models/db.py b/models/db.py
index 0ef64e0..b1fda55 100644
--- a/models/db.py
+++ b/models/db.py
@@ -5,7 +5,7 @@
# Auth is for authenticaiton and access control
# -------------------------------------------------------------------------
from gluon.contrib.appconfig import AppConfig
-from gluon.tools import Auth
+from gluon.tools import Aut
# -------------------------------------------------------------------------
# This scaffolding model makes your app work on Google App Engine too
From c978e6c03f599472892723047895754a99f4e96b Mon Sep 17 00:00:00 2001
From: rjzhao1 <44123617+rjzhao1@users.noreply.github.com>
Date: Fri, 19 Oct 2018 01:40:59 -0700
Subject: [PATCH 02/35] Update db.py
---
models/db.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/models/db.py b/models/db.py
index b1fda55..0ef64e0 100644
--- a/models/db.py
+++ b/models/db.py
@@ -5,7 +5,7 @@
# Auth is for authenticaiton and access control
# -------------------------------------------------------------------------
from gluon.contrib.appconfig import AppConfig
-from gluon.tools import Aut
+from gluon.tools import Auth
# -------------------------------------------------------------------------
# This scaffolding model makes your app work on Google App Engine too
From 9d7c544492070aec25db18e3f5e53e8fe6967a0e Mon Sep 17 00:00:00 2001
From: rjzhao1 <44123617+rjzhao1@users.noreply.github.com>
Date: Fri, 19 Oct 2018 02:37:36 -0700
Subject: [PATCH 03/35] Add files via upload
testing
---
db.py | 155 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 155 insertions(+)
create mode 100644 db.py
diff --git a/db.py b/db.py
new file mode 100644
index 0000000..2dfd201
--- /dev/null
+++ b/db.py
@@ -0,0 +1,155 @@
+# -*- coding: utf-8 -*-
+
+# -------------------------------------------------------------------------
+# AppConfig configuration made easy. Look inside private/appconfig.ini
+# Auth is for authenticaiton and access control
+# -------------------------------------------------------------------------
+from gluon.contrib.appconfig import AppConfig
+from gluon.tools import Aut
+
+# -------------------------------------------------------------------------
+# This scaffolding model makes your app work on Google App Engine too
+# File is released under public domain and you can use without limitations
+# -------------------------------------------------------------------------
+
+if request.global_settings.web2py_version < "2.15.5":
+ raise HTTP(500, "Requires web2py 2.15.5 or newer")
+
+# -------------------------------------------------------------------------
+# if SSL/HTTPS is properly configured and you want all HTTP requests to
+# be redirected to HTTPS, uncomment the line below:
+# -------------------------------------------------------------------------
+# request.requires_https()
+
+# -------------------------------------------------------------------------
+# once in production, remove reload=True to gain full speed
+# -------------------------------------------------------------------------
+configuration = AppConfig(reload=True)
+
+if not request.env.web2py_runtime_gae:
+ # ---------------------------------------------------------------------
+ # if NOT running on Google App Engine use SQLite or other DB
+ # ---------------------------------------------------------------------
+ db = DAL(configuration.get('db.uri'),
+ pool_size=configuration.get('db.pool_size'),
+ migrate_enabled=configuration.get('db.migrate'),
+ check_reserved=['all'])
+else:
+ # ---------------------------------------------------------------------
+ # connect to Google BigTable (optional 'google:datastore://namespace')
+ # ---------------------------------------------------------------------
+ db = DAL('google:datastore+ndb')
+ # ---------------------------------------------------------------------
+ # store sessions and tickets there
+ # ---------------------------------------------------------------------
+ session.connect(request, response, db=db)
+ # ---------------------------------------------------------------------
+ # or store session in Memcache, Redis, etc.
+ # from gluon.contrib.memdb import MEMDB
+ # from google.appengine.api.memcache import Client
+ # session.connect(request, response, db = MEMDB(Client()))
+ # ---------------------------------------------------------------------
+
+# -------------------------------------------------------------------------
+# by default give a view/generic.extension to all actions from localhost
+# none otherwise. a pattern can be 'controller/function.extension'
+# -------------------------------------------------------------------------
+response.generic_patterns = []
+if request.is_local and not configuration.get('app.production'):
+ response.generic_patterns.append('*')
+
+# -------------------------------------------------------------------------
+# choose a style for forms
+# -------------------------------------------------------------------------
+response.formstyle = 'bootstrap4_inline'
+response.form_label_separator = ''
+
+# -------------------------------------------------------------------------
+# (optional) optimize handling of static files
+# -------------------------------------------------------------------------
+# response.optimize_css = 'concat,minify,inline'
+# response.optimize_js = 'concat,minify,inline'
+
+# -------------------------------------------------------------------------
+# (optional) static assets folder versioning
+# -------------------------------------------------------------------------
+# response.static_version = '0.0.0'
+
+# -------------------------------------------------------------------------
+# Here is sample code if you need for
+# - email capabilities
+# - authentication (registration, login, logout, ... )
+# - authorization (role based authorization)
+# - services (xml, csv, json, xmlrpc, jsonrpc, amf, rss)
+# - old style crud actions
+# (more options discussed in gluon/tools.py)
+# -------------------------------------------------------------------------
+
+# host names must be a list of allowed host names (glob syntax allowed)
+auth = Auth(db, host_names=configuration.get('host.names'))
+
+# -------------------------------------------------------------------------
+# create all tables needed by auth, maybe add a list of extra fields
+# -------------------------------------------------------------------------
+auth.settings.extra_fields['auth_user'] = []
+auth.define_tables(username=False, signature=False)
+
+# -------------------------------------------------------------------------
+# configure email
+# -------------------------------------------------------------------------
+mail = auth.settings.mailer
+mail.settings.server = 'logging' if request.is_local else configuration.get('smtp.server')
+mail.settings.sender = configuration.get('smtp.sender')
+mail.settings.login = configuration.get('smtp.login')
+mail.settings.tls = configuration.get('smtp.tls') or False
+mail.settings.ssl = configuration.get('smtp.ssl') or False
+
+# -------------------------------------------------------------------------
+# configure auth policy
+# -------------------------------------------------------------------------
+auth.settings.registration_requires_verification = False
+auth.settings.registration_requires_approval = False
+auth.settings.reset_password_requires_verification = True
+
+# -------------------------------------------------------------------------
+# read more at http://dev.w3.org/html5/markup/meta.name.html
+# -------------------------------------------------------------------------
+response.meta.author = configuration.get('app.author')
+response.meta.description = configuration.get('app.description')
+response.meta.keywords = configuration.get('app.keywords')
+response.meta.generator = configuration.get('app.generator')
+response.show_toolbar = configuration.get('app.toolbar')
+
+# -------------------------------------------------------------------------
+# your http://google.com/analytics id
+# -------------------------------------------------------------------------
+response.google_analytics_id = configuration.get('google.analytics_id')
+
+# -------------------------------------------------------------------------
+# maybe use the scheduler
+# -------------------------------------------------------------------------
+if configuration.get('scheduler.enabled'):
+ from gluon.scheduler import Scheduler
+ scheduler = Scheduler(db, heartbeat=configuration.get('scheduler.heartbeat'))
+
+# -------------------------------------------------------------------------
+# Define your tables below (or better in another model file) for example
+#
+# >>> db.define_table('mytable', Field('myfield', 'string'))
+#
+# Fields can be 'string','text','password','integer','double','boolean'
+# 'date','time','datetime','blob','upload', 'reference TABLENAME'
+# There is an implicit 'id integer autoincrement' field
+# Consult manual for more options, validators, etc.
+#
+# More API examples for controllers:
+#
+# >>> db.mytable.insert(myfield='value')
+# >>> rows = db(db.mytable.myfield == 'value').select(db.mytable.ALL)
+# >>> for row in rows: print row.id, row.myfield
+# -------------------------------------------------------------------------
+
+# -------------------------------------------------------------------------
+# after defining tables, uncomment below to enable auditing
+# -------------------------------------------------------------------------
+# auth.enable_record_versioning(db)
From 236fd7d967b79a191a257fa6ea75141b777c0932 Mon Sep 17 00:00:00 2001
From: rjzhao1 <44123617+rjzhao1@users.noreply.github.com>
Date: Fri, 19 Oct 2018 02:38:11 -0700
Subject: [PATCH 04/35] Delete db.py
---
db.py | 155 ----------------------------------------------------------
1 file changed, 155 deletions(-)
delete mode 100644 db.py
diff --git a/db.py b/db.py
deleted file mode 100644
index 2dfd201..0000000
--- a/db.py
+++ /dev/null
@@ -1,155 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# -------------------------------------------------------------------------
-# AppConfig configuration made easy. Look inside private/appconfig.ini
-# Auth is for authenticaiton and access control
-# -------------------------------------------------------------------------
-from gluon.contrib.appconfig import AppConfig
-from gluon.tools import Aut
-
-# -------------------------------------------------------------------------
-# This scaffolding model makes your app work on Google App Engine too
-# File is released under public domain and you can use without limitations
-# -------------------------------------------------------------------------
-
-if request.global_settings.web2py_version < "2.15.5":
- raise HTTP(500, "Requires web2py 2.15.5 or newer")
-
-# -------------------------------------------------------------------------
-# if SSL/HTTPS is properly configured and you want all HTTP requests to
-# be redirected to HTTPS, uncomment the line below:
-# -------------------------------------------------------------------------
-# request.requires_https()
-
-# -------------------------------------------------------------------------
-# once in production, remove reload=True to gain full speed
-# -------------------------------------------------------------------------
-configuration = AppConfig(reload=True)
-
-if not request.env.web2py_runtime_gae:
- # ---------------------------------------------------------------------
- # if NOT running on Google App Engine use SQLite or other DB
- # ---------------------------------------------------------------------
- db = DAL(configuration.get('db.uri'),
- pool_size=configuration.get('db.pool_size'),
- migrate_enabled=configuration.get('db.migrate'),
- check_reserved=['all'])
-else:
- # ---------------------------------------------------------------------
- # connect to Google BigTable (optional 'google:datastore://namespace')
- # ---------------------------------------------------------------------
- db = DAL('google:datastore+ndb')
- # ---------------------------------------------------------------------
- # store sessions and tickets there
- # ---------------------------------------------------------------------
- session.connect(request, response, db=db)
- # ---------------------------------------------------------------------
- # or store session in Memcache, Redis, etc.
- # from gluon.contrib.memdb import MEMDB
- # from google.appengine.api.memcache import Client
- # session.connect(request, response, db = MEMDB(Client()))
- # ---------------------------------------------------------------------
-
-# -------------------------------------------------------------------------
-# by default give a view/generic.extension to all actions from localhost
-# none otherwise. a pattern can be 'controller/function.extension'
-# -------------------------------------------------------------------------
-response.generic_patterns = []
-if request.is_local and not configuration.get('app.production'):
- response.generic_patterns.append('*')
-
-# -------------------------------------------------------------------------
-# choose a style for forms
-# -------------------------------------------------------------------------
-response.formstyle = 'bootstrap4_inline'
-response.form_label_separator = ''
-
-# -------------------------------------------------------------------------
-# (optional) optimize handling of static files
-# -------------------------------------------------------------------------
-# response.optimize_css = 'concat,minify,inline'
-# response.optimize_js = 'concat,minify,inline'
-
-# -------------------------------------------------------------------------
-# (optional) static assets folder versioning
-# -------------------------------------------------------------------------
-# response.static_version = '0.0.0'
-
-# -------------------------------------------------------------------------
-# Here is sample code if you need for
-# - email capabilities
-# - authentication (registration, login, logout, ... )
-# - authorization (role based authorization)
-# - services (xml, csv, json, xmlrpc, jsonrpc, amf, rss)
-# - old style crud actions
-# (more options discussed in gluon/tools.py)
-# -------------------------------------------------------------------------
-
-# host names must be a list of allowed host names (glob syntax allowed)
-auth = Auth(db, host_names=configuration.get('host.names'))
-
-# -------------------------------------------------------------------------
-# create all tables needed by auth, maybe add a list of extra fields
-# -------------------------------------------------------------------------
-auth.settings.extra_fields['auth_user'] = []
-auth.define_tables(username=False, signature=False)
-
-# -------------------------------------------------------------------------
-# configure email
-# -------------------------------------------------------------------------
-mail = auth.settings.mailer
-mail.settings.server = 'logging' if request.is_local else configuration.get('smtp.server')
-mail.settings.sender = configuration.get('smtp.sender')
-mail.settings.login = configuration.get('smtp.login')
-mail.settings.tls = configuration.get('smtp.tls') or False
-mail.settings.ssl = configuration.get('smtp.ssl') or False
-
-# -------------------------------------------------------------------------
-# configure auth policy
-# -------------------------------------------------------------------------
-auth.settings.registration_requires_verification = False
-auth.settings.registration_requires_approval = False
-auth.settings.reset_password_requires_verification = True
-
-# -------------------------------------------------------------------------
-# read more at http://dev.w3.org/html5/markup/meta.name.html
-# -------------------------------------------------------------------------
-response.meta.author = configuration.get('app.author')
-response.meta.description = configuration.get('app.description')
-response.meta.keywords = configuration.get('app.keywords')
-response.meta.generator = configuration.get('app.generator')
-response.show_toolbar = configuration.get('app.toolbar')
-
-# -------------------------------------------------------------------------
-# your http://google.com/analytics id
-# -------------------------------------------------------------------------
-response.google_analytics_id = configuration.get('google.analytics_id')
-
-# -------------------------------------------------------------------------
-# maybe use the scheduler
-# -------------------------------------------------------------------------
-if configuration.get('scheduler.enabled'):
- from gluon.scheduler import Scheduler
- scheduler = Scheduler(db, heartbeat=configuration.get('scheduler.heartbeat'))
-
-# -------------------------------------------------------------------------
-# Define your tables below (or better in another model file) for example
-#
-# >>> db.define_table('mytable', Field('myfield', 'string'))
-#
-# Fields can be 'string','text','password','integer','double','boolean'
-# 'date','time','datetime','blob','upload', 'reference TABLENAME'
-# There is an implicit 'id integer autoincrement' field
-# Consult manual for more options, validators, etc.
-#
-# More API examples for controllers:
-#
-# >>> db.mytable.insert(myfield='value')
-# >>> rows = db(db.mytable.myfield == 'value').select(db.mytable.ALL)
-# >>> for row in rows: print row.id, row.myfield
-# -------------------------------------------------------------------------
-
-# -------------------------------------------------------------------------
-# after defining tables, uncomment below to enable auditing
-# -------------------------------------------------------------------------
-# auth.enable_record_versioning(db)
From 1f46761b2319dfd7fecec56b13091b16ee22352a Mon Sep 17 00:00:00 2001
From: rjzhao1 <44123617+rjzhao1@users.noreply.github.com>
Date: Fri, 19 Oct 2018 02:38:30 -0700
Subject: [PATCH 05/35] Add files via upload
testing
---
models/db.py | 310 +++++++++++++++++++++++++--------------------------
1 file changed, 155 insertions(+), 155 deletions(-)
diff --git a/models/db.py b/models/db.py
index 0ef64e0..2dfd201 100644
--- a/models/db.py
+++ b/models/db.py
@@ -1,155 +1,155 @@
-# -*- coding: utf-8 -*-
-
-# -------------------------------------------------------------------------
-# AppConfig configuration made easy. Look inside private/appconfig.ini
-# Auth is for authenticaiton and access control
-# -------------------------------------------------------------------------
-from gluon.contrib.appconfig import AppConfig
-from gluon.tools import Auth
-
-# -------------------------------------------------------------------------
-# This scaffolding model makes your app work on Google App Engine too
-# File is released under public domain and you can use without limitations
-# -------------------------------------------------------------------------
-
-if request.global_settings.web2py_version < "2.15.5":
- raise HTTP(500, "Requires web2py 2.15.5 or newer")
-
-# -------------------------------------------------------------------------
-# if SSL/HTTPS is properly configured and you want all HTTP requests to
-# be redirected to HTTPS, uncomment the line below:
-# -------------------------------------------------------------------------
-# request.requires_https()
-
-# -------------------------------------------------------------------------
-# once in production, remove reload=True to gain full speed
-# -------------------------------------------------------------------------
-configuration = AppConfig(reload=True)
-
-if not request.env.web2py_runtime_gae:
- # ---------------------------------------------------------------------
- # if NOT running on Google App Engine use SQLite or other DB
- # ---------------------------------------------------------------------
- db = DAL(configuration.get('db.uri'),
- pool_size=configuration.get('db.pool_size'),
- migrate_enabled=configuration.get('db.migrate'),
- check_reserved=['all'])
-else:
- # ---------------------------------------------------------------------
- # connect to Google BigTable (optional 'google:datastore://namespace')
- # ---------------------------------------------------------------------
- db = DAL('google:datastore+ndb')
- # ---------------------------------------------------------------------
- # store sessions and tickets there
- # ---------------------------------------------------------------------
- session.connect(request, response, db=db)
- # ---------------------------------------------------------------------
- # or store session in Memcache, Redis, etc.
- # from gluon.contrib.memdb import MEMDB
- # from google.appengine.api.memcache import Client
- # session.connect(request, response, db = MEMDB(Client()))
- # ---------------------------------------------------------------------
-
-# -------------------------------------------------------------------------
-# by default give a view/generic.extension to all actions from localhost
-# none otherwise. a pattern can be 'controller/function.extension'
-# -------------------------------------------------------------------------
-response.generic_patterns = []
-if request.is_local and not configuration.get('app.production'):
- response.generic_patterns.append('*')
-
-# -------------------------------------------------------------------------
-# choose a style for forms
-# -------------------------------------------------------------------------
-response.formstyle = 'bootstrap4_inline'
-response.form_label_separator = ''
-
-# -------------------------------------------------------------------------
-# (optional) optimize handling of static files
-# -------------------------------------------------------------------------
-# response.optimize_css = 'concat,minify,inline'
-# response.optimize_js = 'concat,minify,inline'
-
-# -------------------------------------------------------------------------
-# (optional) static assets folder versioning
-# -------------------------------------------------------------------------
-# response.static_version = '0.0.0'
-
-# -------------------------------------------------------------------------
-# Here is sample code if you need for
-# - email capabilities
-# - authentication (registration, login, logout, ... )
-# - authorization (role based authorization)
-# - services (xml, csv, json, xmlrpc, jsonrpc, amf, rss)
-# - old style crud actions
-# (more options discussed in gluon/tools.py)
-# -------------------------------------------------------------------------
-
-# host names must be a list of allowed host names (glob syntax allowed)
-auth = Auth(db, host_names=configuration.get('host.names'))
-
-# -------------------------------------------------------------------------
-# create all tables needed by auth, maybe add a list of extra fields
-# -------------------------------------------------------------------------
-auth.settings.extra_fields['auth_user'] = []
-auth.define_tables(username=False, signature=False)
-
-# -------------------------------------------------------------------------
-# configure email
-# -------------------------------------------------------------------------
-mail = auth.settings.mailer
-mail.settings.server = 'logging' if request.is_local else configuration.get('smtp.server')
-mail.settings.sender = configuration.get('smtp.sender')
-mail.settings.login = configuration.get('smtp.login')
-mail.settings.tls = configuration.get('smtp.tls') or False
-mail.settings.ssl = configuration.get('smtp.ssl') or False
-
-# -------------------------------------------------------------------------
-# configure auth policy
-# -------------------------------------------------------------------------
-auth.settings.registration_requires_verification = False
-auth.settings.registration_requires_approval = False
-auth.settings.reset_password_requires_verification = True
-
-# -------------------------------------------------------------------------
-# read more at http://dev.w3.org/html5/markup/meta.name.html
-# -------------------------------------------------------------------------
-response.meta.author = configuration.get('app.author')
-response.meta.description = configuration.get('app.description')
-response.meta.keywords = configuration.get('app.keywords')
-response.meta.generator = configuration.get('app.generator')
-response.show_toolbar = configuration.get('app.toolbar')
-
-# -------------------------------------------------------------------------
-# your http://google.com/analytics id
-# -------------------------------------------------------------------------
-response.google_analytics_id = configuration.get('google.analytics_id')
-
-# -------------------------------------------------------------------------
-# maybe use the scheduler
-# -------------------------------------------------------------------------
-if configuration.get('scheduler.enabled'):
- from gluon.scheduler import Scheduler
- scheduler = Scheduler(db, heartbeat=configuration.get('scheduler.heartbeat'))
-
-# -------------------------------------------------------------------------
-# Define your tables below (or better in another model file) for example
-#
-# >>> db.define_table('mytable', Field('myfield', 'string'))
-#
-# Fields can be 'string','text','password','integer','double','boolean'
-# 'date','time','datetime','blob','upload', 'reference TABLENAME'
-# There is an implicit 'id integer autoincrement' field
-# Consult manual for more options, validators, etc.
-#
-# More API examples for controllers:
-#
-# >>> db.mytable.insert(myfield='value')
-# >>> rows = db(db.mytable.myfield == 'value').select(db.mytable.ALL)
-# >>> for row in rows: print row.id, row.myfield
-# -------------------------------------------------------------------------
-
-# -------------------------------------------------------------------------
-# after defining tables, uncomment below to enable auditing
-# -------------------------------------------------------------------------
-# auth.enable_record_versioning(db)
+# -*- coding: utf-8 -*-
+
+# -------------------------------------------------------------------------
+# AppConfig configuration made easy. Look inside private/appconfig.ini
+# Auth is for authenticaiton and access control
+# -------------------------------------------------------------------------
+from gluon.contrib.appconfig import AppConfig
+from gluon.tools import Aut
+
+# -------------------------------------------------------------------------
+# This scaffolding model makes your app work on Google App Engine too
+# File is released under public domain and you can use without limitations
+# -------------------------------------------------------------------------
+
+if request.global_settings.web2py_version < "2.15.5":
+ raise HTTP(500, "Requires web2py 2.15.5 or newer")
+
+# -------------------------------------------------------------------------
+# if SSL/HTTPS is properly configured and you want all HTTP requests to
+# be redirected to HTTPS, uncomment the line below:
+# -------------------------------------------------------------------------
+# request.requires_https()
+
+# -------------------------------------------------------------------------
+# once in production, remove reload=True to gain full speed
+# -------------------------------------------------------------------------
+configuration = AppConfig(reload=True)
+
+if not request.env.web2py_runtime_gae:
+ # ---------------------------------------------------------------------
+ # if NOT running on Google App Engine use SQLite or other DB
+ # ---------------------------------------------------------------------
+ db = DAL(configuration.get('db.uri'),
+ pool_size=configuration.get('db.pool_size'),
+ migrate_enabled=configuration.get('db.migrate'),
+ check_reserved=['all'])
+else:
+ # ---------------------------------------------------------------------
+ # connect to Google BigTable (optional 'google:datastore://namespace')
+ # ---------------------------------------------------------------------
+ db = DAL('google:datastore+ndb')
+ # ---------------------------------------------------------------------
+ # store sessions and tickets there
+ # ---------------------------------------------------------------------
+ session.connect(request, response, db=db)
+ # ---------------------------------------------------------------------
+ # or store session in Memcache, Redis, etc.
+ # from gluon.contrib.memdb import MEMDB
+ # from google.appengine.api.memcache import Client
+ # session.connect(request, response, db = MEMDB(Client()))
+ # ---------------------------------------------------------------------
+
+# -------------------------------------------------------------------------
+# by default give a view/generic.extension to all actions from localhost
+# none otherwise. a pattern can be 'controller/function.extension'
+# -------------------------------------------------------------------------
+response.generic_patterns = []
+if request.is_local and not configuration.get('app.production'):
+ response.generic_patterns.append('*')
+
+# -------------------------------------------------------------------------
+# choose a style for forms
+# -------------------------------------------------------------------------
+response.formstyle = 'bootstrap4_inline'
+response.form_label_separator = ''
+
+# -------------------------------------------------------------------------
+# (optional) optimize handling of static files
+# -------------------------------------------------------------------------
+# response.optimize_css = 'concat,minify,inline'
+# response.optimize_js = 'concat,minify,inline'
+
+# -------------------------------------------------------------------------
+# (optional) static assets folder versioning
+# -------------------------------------------------------------------------
+# response.static_version = '0.0.0'
+
+# -------------------------------------------------------------------------
+# Here is sample code if you need for
+# - email capabilities
+# - authentication (registration, login, logout, ... )
+# - authorization (role based authorization)
+# - services (xml, csv, json, xmlrpc, jsonrpc, amf, rss)
+# - old style crud actions
+# (more options discussed in gluon/tools.py)
+# -------------------------------------------------------------------------
+
+# host names must be a list of allowed host names (glob syntax allowed)
+auth = Auth(db, host_names=configuration.get('host.names'))
+
+# -------------------------------------------------------------------------
+# create all tables needed by auth, maybe add a list of extra fields
+# -------------------------------------------------------------------------
+auth.settings.extra_fields['auth_user'] = []
+auth.define_tables(username=False, signature=False)
+
+# -------------------------------------------------------------------------
+# configure email
+# -------------------------------------------------------------------------
+mail = auth.settings.mailer
+mail.settings.server = 'logging' if request.is_local else configuration.get('smtp.server')
+mail.settings.sender = configuration.get('smtp.sender')
+mail.settings.login = configuration.get('smtp.login')
+mail.settings.tls = configuration.get('smtp.tls') or False
+mail.settings.ssl = configuration.get('smtp.ssl') or False
+
+# -------------------------------------------------------------------------
+# configure auth policy
+# -------------------------------------------------------------------------
+auth.settings.registration_requires_verification = False
+auth.settings.registration_requires_approval = False
+auth.settings.reset_password_requires_verification = True
+
+# -------------------------------------------------------------------------
+# read more at http://dev.w3.org/html5/markup/meta.name.html
+# -------------------------------------------------------------------------
+response.meta.author = configuration.get('app.author')
+response.meta.description = configuration.get('app.description')
+response.meta.keywords = configuration.get('app.keywords')
+response.meta.generator = configuration.get('app.generator')
+response.show_toolbar = configuration.get('app.toolbar')
+
+# -------------------------------------------------------------------------
+# your http://google.com/analytics id
+# -------------------------------------------------------------------------
+response.google_analytics_id = configuration.get('google.analytics_id')
+
+# -------------------------------------------------------------------------
+# maybe use the scheduler
+# -------------------------------------------------------------------------
+if configuration.get('scheduler.enabled'):
+ from gluon.scheduler import Scheduler
+ scheduler = Scheduler(db, heartbeat=configuration.get('scheduler.heartbeat'))
+
+# -------------------------------------------------------------------------
+# Define your tables below (or better in another model file) for example
+#
+# >>> db.define_table('mytable', Field('myfield', 'string'))
+#
+# Fields can be 'string','text','password','integer','double','boolean'
+# 'date','time','datetime','blob','upload', 'reference TABLENAME'
+# There is an implicit 'id integer autoincrement' field
+# Consult manual for more options, validators, etc.
+#
+# More API examples for controllers:
+#
+# >>> db.mytable.insert(myfield='value')
+# >>> rows = db(db.mytable.myfield == 'value').select(db.mytable.ALL)
+# >>> for row in rows: print row.id, row.myfield
+# -------------------------------------------------------------------------
+
+# -------------------------------------------------------------------------
+# after defining tables, uncomment below to enable auditing
+# -------------------------------------------------------------------------
+# auth.enable_record_versioning(db)
From 1ce7787f70fecaf26dd0d5b6149a1b68d1f26b02 Mon Sep 17 00:00:00 2001
From: rjzhao1 <44123617+rjzhao1@users.noreply.github.com>
Date: Fri, 19 Oct 2018 02:38:52 -0700
Subject: [PATCH 06/35] Update db.py
---
models/db.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/models/db.py b/models/db.py
index 2dfd201..09b38f0 100644
--- a/models/db.py
+++ b/models/db.py
@@ -5,7 +5,7 @@
# Auth is for authenticaiton and access control
# -------------------------------------------------------------------------
from gluon.contrib.appconfig import AppConfig
-from gluon.tools import Aut
+from gluon.tools import Auth
# -------------------------------------------------------------------------
# This scaffolding model makes your app work on Google App Engine too
From efd1fefb48cceb39f352dfc3845cfc13260cfc80 Mon Sep 17 00:00:00 2001
From: rjzhao1 <44123617+rjzhao1@users.noreply.github.com>
Date: Fri, 19 Oct 2018 02:41:03 -0700
Subject: [PATCH 07/35] testing
---
models/db.py | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/models/db.py b/models/db.py
index 09b38f0..f128764 100644
--- a/models/db.py
+++ b/models/db.py
@@ -1,5 +1,3 @@
-# -*- coding: utf-8 -*-
-
# -------------------------------------------------------------------------
# AppConfig configuration made easy. Look inside private/appconfig.ini
# Auth is for authenticaiton and access control
@@ -91,8 +89,13 @@
# -------------------------------------------------------------------------
# create all tables needed by auth, maybe add a list of extra fields
# -------------------------------------------------------------------------
-auth.settings.extra_fields['auth_user'] = []
-auth.define_tables(username=False, signature=False)
+
+auth.settings.extra_fields['auth_user']= [
+ Field('user_address', type='string'),
+ Field('latitude', type='integer'),
+ Field('longitude', type='integer')]
+
+auth.define_tables(username=True, signature=False)
# -------------------------------------------------------------------------
# configure email
@@ -135,7 +138,19 @@
# -------------------------------------------------------------------------
# Define your tables below (or better in another model file) for example
#
-# >>> db.define_table('mytable', Field('myfield', 'string'))
+
+
+db.define_table('resources',
+ Field('resources_id', type='integer', unique=True),
+ Field('resources_type', type='string'),
+ Field('resources_qty', type='integer'),
+ Field('resource_owner', type='reference auth_user'))
+
+db.define_table('pooltable',
+ Field('pooltable_id', type='integer', unique=True),
+ Field('user_id', type='reference auth_user'),
+ Field('resources_id', type='reference resources'))
+
#
# Fields can be 'string','text','password','integer','double','boolean'
# 'date','time','datetime','blob','upload', 'reference TABLENAME'
@@ -152,4 +167,4 @@
# -------------------------------------------------------------------------
# after defining tables, uncomment below to enable auditing
# -------------------------------------------------------------------------
-# auth.enable_record_versioning(db)
+auth.enable_record_versioning(db)
\ No newline at end of file
From f4205a64ccd96d72aa4ee622708555eec35a9361 Mon Sep 17 00:00:00 2001
From: rjzhao1 <44123617+rjzhao1@users.noreply.github.com>
Date: Fri, 19 Oct 2018 02:42:02 -0700
Subject: [PATCH 08/35] testing 2
---
models/db.py | 2 +-
models/menu.py | 220 ++++++++++++++++++++++++-------------------------
2 files changed, 111 insertions(+), 111 deletions(-)
diff --git a/models/db.py b/models/db.py
index f128764..70d8c69 100644
--- a/models/db.py
+++ b/models/db.py
@@ -3,7 +3,7 @@
# Auth is for authenticaiton and access control
# -------------------------------------------------------------------------
from gluon.contrib.appconfig import AppConfig
-from gluon.tools import Auth
+from gluon.tools import Aut
# -------------------------------------------------------------------------
# This scaffolding model makes your app work on Google App Engine too
diff --git a/models/menu.py b/models/menu.py
index 1aed04d..9c97714 100644
--- a/models/menu.py
+++ b/models/menu.py
@@ -1,110 +1,110 @@
-# -*- coding: utf-8 -*-
-# this file is released under public domain and you can use without limitations
-
-# ----------------------------------------------------------------------------------------------------------------------
-# this is the main application menu add/remove items as required
-# ----------------------------------------------------------------------------------------------------------------------
-
-response.menu = [
- (T('Home'), False, URL('default', 'index'), [])
-]
-
-# ----------------------------------------------------------------------------------------------------------------------
-# provide shortcuts for development. you can remove everything below in production
-# ----------------------------------------------------------------------------------------------------------------------
-
-if not configuration.get('app.production'):
- _app = request.application
- response.menu += [
- (T('My Sites'), False, URL('admin', 'default', 'site')),
- (T('This App'), False, '#', [
- (T('Design'), False, URL('admin', 'default', 'design/%s' % _app)),
- (T('Controller'), False,
- URL(
- 'admin', 'default', 'edit/%s/controllers/%s.py' % (_app, request.controller))),
- (T('View'), False,
- URL(
- 'admin', 'default', 'edit/%s/views/%s' % (_app, response.view))),
- (T('DB Model'), False,
- URL(
- 'admin', 'default', 'edit/%s/models/db.py' % _app)),
- (T('Menu Model'), False,
- URL(
- 'admin', 'default', 'edit/%s/models/menu.py' % _app)),
- (T('Config.ini'), False,
- URL(
- 'admin', 'default', 'edit/%s/private/appconfig.ini' % _app)),
- (T('Layout'), False,
- URL(
- 'admin', 'default', 'edit/%s/views/layout.html' % _app)),
- (T('Stylesheet'), False,
- URL(
- 'admin', 'default', 'edit/%s/static/css/web2py-bootstrap3.css' % _app)),
- (T('Database'), False, URL(_app, 'appadmin', 'index')),
- (T('Errors'), False, URL(
- 'admin', 'default', 'errors/' + _app)),
- (T('About'), False, URL(
- 'admin', 'default', 'about/' + _app)),
- ]),
- ('web2py.com', False, '#', [
- (T('Download'), False,
- 'http://www.web2py.com/examples/default/download'),
- (T('Support'), False,
- 'http://www.web2py.com/examples/default/support'),
- (T('Demo'), False, 'http://web2py.com/demo_admin'),
- (T('Quick Examples'), False,
- 'http://web2py.com/examples/default/examples'),
- (T('FAQ'), False, 'http://web2py.com/AlterEgo'),
- (T('Videos'), False,
- 'http://www.web2py.com/examples/default/videos/'),
- (T('Free Applications'),
- False, 'http://web2py.com/appliances'),
- (T('Plugins'), False, 'http://web2py.com/plugins'),
- (T('Recipes'), False, 'http://web2pyslices.com/'),
- ]),
- (T('Documentation'), False, '#', [
- (T('Online book'), False, 'http://www.web2py.com/book'),
- (T('Preface'), False,
- 'http://www.web2py.com/book/default/chapter/00'),
- (T('Introduction'), False,
- 'http://www.web2py.com/book/default/chapter/01'),
- (T('Python'), False,
- 'http://www.web2py.com/book/default/chapter/02'),
- (T('Overview'), False,
- 'http://www.web2py.com/book/default/chapter/03'),
- (T('The Core'), False,
- 'http://www.web2py.com/book/default/chapter/04'),
- (T('The Views'), False,
- 'http://www.web2py.com/book/default/chapter/05'),
- (T('Database'), False,
- 'http://www.web2py.com/book/default/chapter/06'),
- (T('Forms and Validators'), False,
- 'http://www.web2py.com/book/default/chapter/07'),
- (T('Email and SMS'), False,
- 'http://www.web2py.com/book/default/chapter/08'),
- (T('Access Control'), False,
- 'http://www.web2py.com/book/default/chapter/09'),
- (T('Services'), False,
- 'http://www.web2py.com/book/default/chapter/10'),
- (T('Ajax Recipes'), False,
- 'http://www.web2py.com/book/default/chapter/11'),
- (T('Components and Plugins'), False,
- 'http://www.web2py.com/book/default/chapter/12'),
- (T('Deployment Recipes'), False,
- 'http://www.web2py.com/book/default/chapter/13'),
- (T('Other Recipes'), False,
- 'http://www.web2py.com/book/default/chapter/14'),
- (T('Helping web2py'), False,
- 'http://www.web2py.com/book/default/chapter/15'),
- (T("Buy web2py's book"), False,
- 'http://stores.lulu.com/web2py'),
- ]),
- (T('Community'), False, None, [
- (T('Groups'), False,
- 'http://www.web2py.com/examples/default/usergroups'),
- (T('Twitter'), False, 'http://twitter.com/web2py'),
- (T('Live Chat'), False,
- 'http://webchat.freenode.net/?channels=web2py'),
- ]),
- ]
-
+# -*- coding: utf-8 -*-
+# this file is released under public domain and you can use without limitations
+
+# ----------------------------------------------------------------------------------------------------------------------
+# this is the main application menu add/remove items as required
+# ----------------------------------------------------------------------------------------------------------------------
+
+response.men = [
+ (T('Home'), False, URL('default', 'index'), [])
+]
+
+# ----------------------------------------------------------------------------------------------------------------------
+# provide shortcuts for development. you can remove everything below in production
+# ----------------------------------------------------------------------------------------------------------------------
+
+if not configuration.get('app.production'):
+ _app = request.application
+ response.menu += [
+ (T('My Sites'), False, URL('admin', 'default', 'site')),
+ (T('This App'), False, '#', [
+ (T('Design'), False, URL('admin', 'default', 'design/%s' % _app)),
+ (T('Controller'), False,
+ URL(
+ 'admin', 'default', 'edit/%s/controllers/%s.py' % (_app, request.controller))),
+ (T('View'), False,
+ URL(
+ 'admin', 'default', 'edit/%s/views/%s' % (_app, response.view))),
+ (T('DB Model'), False,
+ URL(
+ 'admin', 'default', 'edit/%s/models/db.py' % _app)),
+ (T('Menu Model'), False,
+ URL(
+ 'admin', 'default', 'edit/%s/models/menu.py' % _app)),
+ (T('Config.ini'), False,
+ URL(
+ 'admin', 'default', 'edit/%s/private/appconfig.ini' % _app)),
+ (T('Layout'), False,
+ URL(
+ 'admin', 'default', 'edit/%s/views/layout.html' % _app)),
+ (T('Stylesheet'), False,
+ URL(
+ 'admin', 'default', 'edit/%s/static/css/web2py-bootstrap3.css' % _app)),
+ (T('Database'), False, URL(_app, 'appadmin', 'index')),
+ (T('Errors'), False, URL(
+ 'admin', 'default', 'errors/' + _app)),
+ (T('About'), False, URL(
+ 'admin', 'default', 'about/' + _app)),
+ ]),
+ ('web2py.com', False, '#', [
+ (T('Download'), False,
+ 'http://www.web2py.com/examples/default/download'),
+ (T('Support'), False,
+ 'http://www.web2py.com/examples/default/support'),
+ (T('Demo'), False, 'http://web2py.com/demo_admin'),
+ (T('Quick Examples'), False,
+ 'http://web2py.com/examples/default/examples'),
+ (T('FAQ'), False, 'http://web2py.com/AlterEgo'),
+ (T('Videos'), False,
+ 'http://www.web2py.com/examples/default/videos/'),
+ (T('Free Applications'),
+ False, 'http://web2py.com/appliances'),
+ (T('Plugins'), False, 'http://web2py.com/plugins'),
+ (T('Recipes'), False, 'http://web2pyslices.com/'),
+ ]),
+ (T('Documentation'), False, '#', [
+ (T('Online book'), False, 'http://www.web2py.com/book'),
+ (T('Preface'), False,
+ 'http://www.web2py.com/book/default/chapter/00'),
+ (T('Introduction'), False,
+ 'http://www.web2py.com/book/default/chapter/01'),
+ (T('Python'), False,
+ 'http://www.web2py.com/book/default/chapter/02'),
+ (T('Overview'), False,
+ 'http://www.web2py.com/book/default/chapter/03'),
+ (T('The Core'), False,
+ 'http://www.web2py.com/book/default/chapter/04'),
+ (T('The Views'), False,
+ 'http://www.web2py.com/book/default/chapter/05'),
+ (T('Database'), False,
+ 'http://www.web2py.com/book/default/chapter/06'),
+ (T('Forms and Validators'), False,
+ 'http://www.web2py.com/book/default/chapter/07'),
+ (T('Email and SMS'), False,
+ 'http://www.web2py.com/book/default/chapter/08'),
+ (T('Access Control'), False,
+ 'http://www.web2py.com/book/default/chapter/09'),
+ (T('Services'), False,
+ 'http://www.web2py.com/book/default/chapter/10'),
+ (T('Ajax Recipes'), False,
+ 'http://www.web2py.com/book/default/chapter/11'),
+ (T('Components and Plugins'), False,
+ 'http://www.web2py.com/book/default/chapter/12'),
+ (T('Deployment Recipes'), False,
+ 'http://www.web2py.com/book/default/chapter/13'),
+ (T('Other Recipes'), False,
+ 'http://www.web2py.com/book/default/chapter/14'),
+ (T('Helping web2py'), False,
+ 'http://www.web2py.com/book/default/chapter/15'),
+ (T("Buy web2py's book"), False,
+ 'http://stores.lulu.com/web2py'),
+ ]),
+ (T('Community'), False, None, [
+ (T('Groups'), False,
+ 'http://www.web2py.com/examples/default/usergroups'),
+ (T('Twitter'), False, 'http://twitter.com/web2py'),
+ (T('Live Chat'), False,
+ 'http://webchat.freenode.net/?channels=web2py'),
+ ]),
+ ]
+
From 4c653e775e1217dfc590823cf67012a995cee9d0 Mon Sep 17 00:00:00 2001
From: rjzhao1 <44123617+rjzhao1@users.noreply.github.com>
Date: Fri, 19 Oct 2018 02:42:33 -0700
Subject: [PATCH 09/35] Update db.py
---
models/db.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/models/db.py b/models/db.py
index 70d8c69..af0222f 100644
--- a/models/db.py
+++ b/models/db.py
@@ -3,7 +3,7 @@
# Auth is for authenticaiton and access control
# -------------------------------------------------------------------------
from gluon.contrib.appconfig import AppConfig
-from gluon.tools import Aut
+from gluon.tools import Auth
# -------------------------------------------------------------------------
# This scaffolding model makes your app work on Google App Engine too
@@ -167,4 +167,4 @@
# -------------------------------------------------------------------------
# after defining tables, uncomment below to enable auditing
# -------------------------------------------------------------------------
-auth.enable_record_versioning(db)
\ No newline at end of file
+auth.enable_record_versioning(db)
From 4e2cbc0fb5576ce9b9896ff290263bdb16d3d59e Mon Sep 17 00:00:00 2001
From: rjzhao1 <44123617+rjzhao1@users.noreply.github.com>
Date: Fri, 19 Oct 2018 02:43:15 -0700
Subject: [PATCH 10/35] Update menu.py
---
models/menu.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/models/menu.py b/models/menu.py
index 9c97714..d350066 100644
--- a/models/menu.py
+++ b/models/menu.py
@@ -5,7 +5,7 @@
# this is the main application menu add/remove items as required
# ----------------------------------------------------------------------------------------------------------------------
-response.men = [
+response.menu = [
(T('Home'), False, URL('default', 'index'), [])
]
From df456a9e8231433f3666ddb8696bfc80989b48d2 Mon Sep 17 00:00:00 2001
From: rjzhao1 <44123617+rjzhao1@users.noreply.github.com>
Date: Fri, 19 Oct 2018 21:51:51 -0700
Subject: [PATCH 11/35] Added function to display resource of user
---
controllers/default.py | 123 ++++++++++++++++++++++-------------------
1 file changed, 65 insertions(+), 58 deletions(-)
diff --git a/controllers/default.py b/controllers/default.py
index 2225081..939fe1b 100644
--- a/controllers/default.py
+++ b/controllers/default.py
@@ -1,58 +1,65 @@
-# -*- coding: utf-8 -*-
-# -------------------------------------------------------------------------
-# This is a sample controller
-# this file is released under public domain and you can use without limitations
-# -------------------------------------------------------------------------
-
-# ---- example index page ----
-def index():
- response.flash = T("Hello World")
- return dict(message=T('Welcome to web2py!'))
-
-# ---- API (example) -----
-@auth.requires_login()
-def api_get_user_email():
- if not request.env.request_method == 'GET': raise HTTP(403)
- return response.json({'status':'success', 'email':auth.user.email})
-
-# ---- Smart Grid (example) -----
-@auth.requires_membership('admin') # can only be accessed by members of admin groupd
-def grid():
- response.view = 'generic.html' # use a generic view
- tablename = request.args(0)
- if not tablename in db.tables: raise HTTP(403)
- grid = SQLFORM.smartgrid(db[tablename], args=[tablename], deletable=False, editable=False)
- return dict(grid=grid)
-
-# ---- Embedded wiki (example) ----
-def wiki():
- auth.wikimenu() # add the wiki to the menu
- return auth.wiki()
-
-# ---- Action for login/register/etc (required for auth) -----
-def user():
- """
- exposes:
- http://..../[app]/default/user/login
- http://..../[app]/default/user/logout
- http://..../[app]/default/user/register
- http://..../[app]/default/user/profile
- http://..../[app]/default/user/retrieve_password
- http://..../[app]/default/user/change_password
- http://..../[app]/default/user/bulk_register
- use @auth.requires_login()
- @auth.requires_membership('group name')
- @auth.requires_permission('read','table name',record_id)
- to decorate functions that need access control
- also notice there is http://..../[app]/appadmin/manage/auth to allow administrator to manage users
- """
- return dict(form=auth())
-
-# ---- action to server uploaded static content (required) ---
-@cache.action()
-def download():
- """
- allows downloading of uploaded files
- http://..../[app]/default/download/[filename]
- """
- return response.download(request, db)
+# -*- coding: utf-8 -*-
+# -------------------------------------------------------------------------
+# This is a sample controller
+# this file is released under public domain and you can use without limitations
+# -------------------------------------------------------------------------
+
+#https://helpmehelpyou/deafult/list_user_resources/user_id/page
+# ---- example index page ----
+def index():
+ response.flash = T("Hello World")
+ return dict(message=T('Welcome to HelpYouHelpMe'))
+
+def list_user_resources():
+ user_id = request.args(0,cast=int)
+ page = request.args(1,cast=int,default=0)
+ row=db(db.resources.resource_owner==user_id).select()
+ return locals()
+
+# ---- API (example) -----
+@auth.requires_login()
+def api_get_user_email():
+ if not request.env.request_method == 'GET': raise HTTP(403)
+ return response.json({'status':'success', 'email':auth.user.email})
+
+# ---- Smart Grid (example) -----
+@auth.requires_membership('admin') # can only be accessed by members of admin groupd
+def grid():
+ response.view = 'generic.html' # use a generic view
+ tablename = request.args(0)
+ if not tablename in db.tables: raise HTTP(403)
+ grid = SQLFORM.smartgrid(db[tablename], args=[tablename], deletable=False, editable=False)
+ return dict(grid=grid)
+
+# ---- Embedded wiki (example) ----
+def wiki():
+ auth.wikimenu() # add the wiki to the menu
+ return auth.wiki()
+
+# ---- Action for login/register/etc (required for auth) -----
+def user():
+ """
+ exposes:
+ http://..../[app]/default/user/login
+ http://..../[app]/default/user/logout
+ http://..../[app]/default/user/register
+ http://..../[app]/default/user/profile
+ http://..../[app]/default/user/retrieve_password
+ http://..../[app]/default/user/change_password
+ http://..../[app]/default/user/bulk_register
+ use @auth.requires_login()
+ @auth.requires_membership('group name')
+ @auth.requires_permission('read','table name',record_id)
+ to decorate functions that need access control
+ also notice there is http://..../[app]/appadmin/manage/auth to allow administrator to manage users
+ """
+ return dict(form=auth())
+
+# ---- action to server uploaded static content (required) ---
+@cache.action()
+def download():
+ """
+ allows downloading of uploaded files
+ http://..../[app]/default/download/[filename]
+ """
+ return response.download(request, db)
From df961578a3c9be68dc39314d988af67c37e4f68c Mon Sep 17 00:00:00 2001
From: rjzhao1 <44123617+rjzhao1@users.noreply.github.com>
Date: Sat, 27 Oct 2018 19:30:51 -0700
Subject: [PATCH 12/35] Added functions to add resources into the database
---
controllers/default.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/controllers/default.py b/controllers/default.py
index 939fe1b..ce76715 100644
--- a/controllers/default.py
+++ b/controllers/default.py
@@ -12,10 +12,12 @@ def index():
def list_user_resources():
user_id = request.args(0,cast=int)
- page = request.args(1,cast=int,default=0)
row=db(db.resources.resource_owner==user_id).select()
return locals()
+def add_resources():
+ form = SQLFORM(db.resources).process(next=URL(index))
+ return locals()
# ---- API (example) -----
@auth.requires_login()
def api_get_user_email():
From 0777a229a6af4702a0b0135061c8da3e6f304c33 Mon Sep 17 00:00:00 2001
From: rjzhao1 <44123617+rjzhao1@users.noreply.github.com>
Date: Thu, 1 Nov 2018 16:19:34 -0700
Subject: [PATCH 13/35] Add files via upload
---
models/menu.py | 107 +++++--------------------------------------------
1 file changed, 11 insertions(+), 96 deletions(-)
diff --git a/models/menu.py b/models/menu.py
index d350066..07f38c9 100644
--- a/models/menu.py
+++ b/models/menu.py
@@ -8,103 +8,18 @@
response.menu = [
(T('Home'), False, URL('default', 'index'), [])
]
+if session.auth:
+ user_id = session.auth.user.id
+else:
+ user_id = None
+response.menu += [
+ (T('Resources'), False,'#', [
+ (T('View'), False,URL('list_resources',args = user_id)),
+ (T('Add'), False, URL('add_resources')),
+ (T('Other'), False, URL('list_id'))]
+ )
+]
# ----------------------------------------------------------------------------------------------------------------------
# provide shortcuts for development. you can remove everything below in production
# ----------------------------------------------------------------------------------------------------------------------
-
-if not configuration.get('app.production'):
- _app = request.application
- response.menu += [
- (T('My Sites'), False, URL('admin', 'default', 'site')),
- (T('This App'), False, '#', [
- (T('Design'), False, URL('admin', 'default', 'design/%s' % _app)),
- (T('Controller'), False,
- URL(
- 'admin', 'default', 'edit/%s/controllers/%s.py' % (_app, request.controller))),
- (T('View'), False,
- URL(
- 'admin', 'default', 'edit/%s/views/%s' % (_app, response.view))),
- (T('DB Model'), False,
- URL(
- 'admin', 'default', 'edit/%s/models/db.py' % _app)),
- (T('Menu Model'), False,
- URL(
- 'admin', 'default', 'edit/%s/models/menu.py' % _app)),
- (T('Config.ini'), False,
- URL(
- 'admin', 'default', 'edit/%s/private/appconfig.ini' % _app)),
- (T('Layout'), False,
- URL(
- 'admin', 'default', 'edit/%s/views/layout.html' % _app)),
- (T('Stylesheet'), False,
- URL(
- 'admin', 'default', 'edit/%s/static/css/web2py-bootstrap3.css' % _app)),
- (T('Database'), False, URL(_app, 'appadmin', 'index')),
- (T('Errors'), False, URL(
- 'admin', 'default', 'errors/' + _app)),
- (T('About'), False, URL(
- 'admin', 'default', 'about/' + _app)),
- ]),
- ('web2py.com', False, '#', [
- (T('Download'), False,
- 'http://www.web2py.com/examples/default/download'),
- (T('Support'), False,
- 'http://www.web2py.com/examples/default/support'),
- (T('Demo'), False, 'http://web2py.com/demo_admin'),
- (T('Quick Examples'), False,
- 'http://web2py.com/examples/default/examples'),
- (T('FAQ'), False, 'http://web2py.com/AlterEgo'),
- (T('Videos'), False,
- 'http://www.web2py.com/examples/default/videos/'),
- (T('Free Applications'),
- False, 'http://web2py.com/appliances'),
- (T('Plugins'), False, 'http://web2py.com/plugins'),
- (T('Recipes'), False, 'http://web2pyslices.com/'),
- ]),
- (T('Documentation'), False, '#', [
- (T('Online book'), False, 'http://www.web2py.com/book'),
- (T('Preface'), False,
- 'http://www.web2py.com/book/default/chapter/00'),
- (T('Introduction'), False,
- 'http://www.web2py.com/book/default/chapter/01'),
- (T('Python'), False,
- 'http://www.web2py.com/book/default/chapter/02'),
- (T('Overview'), False,
- 'http://www.web2py.com/book/default/chapter/03'),
- (T('The Core'), False,
- 'http://www.web2py.com/book/default/chapter/04'),
- (T('The Views'), False,
- 'http://www.web2py.com/book/default/chapter/05'),
- (T('Database'), False,
- 'http://www.web2py.com/book/default/chapter/06'),
- (T('Forms and Validators'), False,
- 'http://www.web2py.com/book/default/chapter/07'),
- (T('Email and SMS'), False,
- 'http://www.web2py.com/book/default/chapter/08'),
- (T('Access Control'), False,
- 'http://www.web2py.com/book/default/chapter/09'),
- (T('Services'), False,
- 'http://www.web2py.com/book/default/chapter/10'),
- (T('Ajax Recipes'), False,
- 'http://www.web2py.com/book/default/chapter/11'),
- (T('Components and Plugins'), False,
- 'http://www.web2py.com/book/default/chapter/12'),
- (T('Deployment Recipes'), False,
- 'http://www.web2py.com/book/default/chapter/13'),
- (T('Other Recipes'), False,
- 'http://www.web2py.com/book/default/chapter/14'),
- (T('Helping web2py'), False,
- 'http://www.web2py.com/book/default/chapter/15'),
- (T("Buy web2py's book"), False,
- 'http://stores.lulu.com/web2py'),
- ]),
- (T('Community'), False, None, [
- (T('Groups'), False,
- 'http://www.web2py.com/examples/default/usergroups'),
- (T('Twitter'), False, 'http://twitter.com/web2py'),
- (T('Live Chat'), False,
- 'http://webchat.freenode.net/?channels=web2py'),
- ]),
- ]
-
From d5f587b0aeb83531ad3524840ce02927b72477ba Mon Sep 17 00:00:00 2001
From: rjzhao1 <44123617+rjzhao1@users.noreply.github.com>
Date: Thu, 1 Nov 2018 16:20:19 -0700
Subject: [PATCH 14/35] Added tabs for viewing your own resources and other
users
---
menu.py | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
create mode 100644 menu.py
diff --git a/menu.py b/menu.py
new file mode 100644
index 0000000..07f38c9
--- /dev/null
+++ b/menu.py
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+# this file is released under public domain and you can use without limitations
+
+# ----------------------------------------------------------------------------------------------------------------------
+# this is the main application menu add/remove items as required
+# ----------------------------------------------------------------------------------------------------------------------
+
+response.menu = [
+ (T('Home'), False, URL('default', 'index'), [])
+]
+if session.auth:
+ user_id = session.auth.user.id
+else:
+ user_id = None
+
+response.menu += [
+ (T('Resources'), False,'#', [
+ (T('View'), False,URL('list_resources',args = user_id)),
+ (T('Add'), False, URL('add_resources')),
+ (T('Other'), False, URL('list_id'))]
+ )
+]
+# ----------------------------------------------------------------------------------------------------------------------
+# provide shortcuts for development. you can remove everything below in production
+# ----------------------------------------------------------------------------------------------------------------------
From 7e86a70b790331d639b3b14c87b5b6c1cf912a22 Mon Sep 17 00:00:00 2001
From: rjzhao1 <44123617+rjzhao1@users.noreply.github.com>
Date: Thu, 1 Nov 2018 16:21:03 -0700
Subject: [PATCH 15/35] Added viewing other users id function
---
default.py | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 77 insertions(+)
create mode 100644 default.py
diff --git a/default.py b/default.py
new file mode 100644
index 0000000..25d6330
--- /dev/null
+++ b/default.py
@@ -0,0 +1,77 @@
+# -*- coding: utf-8 -*-
+# -------------------------------------------------------------------------
+# This is a sample controller
+# this file is released under public domain and you can use without limitations
+# -------------------------------------------------------------------------
+
+#https://helpmehelpyou/deafult/list_user_resources/user_id/page
+# ---- example index page ----
+def index():
+ response.flash = T("Hello World")
+ return dict(message=T('Welcome to HelpYouHelpMe'))
+
+def list_resources():
+ user_id = request.args(0,cast=int)
+ row=db(db.resources.resource_owner==user_id).select()
+ return locals()
+
+def list_id():
+ row = db(db.auth_user).select()
+ return locals()
+
+def add_resources():
+ form = SQLFORM(db.resources).process(next='list_user_resources/[resource_owner]')
+ return locals()
+
+def edit_resources():
+ user_id = request.args(0,cast=int)
+ form = SQLFORM(db.resources,id).process('list_user_resources/[resource_owner]')
+ return locals()
+
+# ---- API (example) -----
+@auth.requires_login()
+def api_get_user_email():
+ if not request.env.request_method == 'GET': raise HTTP(403)
+ return response.json({'status':'success', 'email':auth.user.email})
+
+# ---- Smart Grid (example) -----
+@auth.requires_membership('admin') # can only be accessed by members of admin groupd
+def grid():
+ response.view = 'generic.html' # use a generic view
+ tablename = request.args(0)
+ if not tablename in db.tables: raise HTTP(403)
+ grid = SQLFORM.smartgrid(db[tablename], args=[tablename], deletable=False, editable=False)
+ return dict(grid=grid)
+
+# ---- Embedded wiki (example) ----
+def wiki():
+ auth.wikimenu() # add the wiki to the menu
+ return auth.wiki()
+
+# ---- Action for login/register/etc (required for auth) -----
+def user():
+ """
+ exposes:
+ http://..../[app]/default/user/login
+ http://..../[app]/default/user/logout
+ http://..../[app]/default/user/register
+ http://..../[app]/default/user/profile
+ http://..../[app]/default/user/retrieve_password
+ http://..../[app]/default/user/change_password
+ http://..../[app]/default/user/bulk_register
+ use @auth.requires_login()
+ @auth.requires_membership('group name')
+ @auth.requires_permission('read','table name',record_id)
+ to decorate functions that need access control
+ also notice there is http://..../[app]/appadmin/manage/auth to allow administrator to manage users
+ """
+ return dict(form=auth())
+
+# ---- action to server uploaded static content (required) ---
+@cache.action()
+def download():
+ """
+ allows downloading of uploaded files
+ http://..../[app]/default/download/[filename]
+ """
+ return response.download(request, db)
From 3ff8e43cd4cdbd9d303b95ca858f96b03c15a19e Mon Sep 17 00:00:00 2001
From: rjzhao1 <44123617+rjzhao1@users.noreply.github.com>
Date: Thu, 1 Nov 2018 18:45:14 -0700
Subject: [PATCH 16/35] added html for list_id and list_resources function
---
views/default/list_id.html | 25 +++++++++++++++++++++++++
views/default/list_resources.html | 29 +++++++++++++++++++++++++++++
2 files changed, 54 insertions(+)
create mode 100644 views/default/list_id.html
create mode 100644 views/default/list_resources.html
diff --git a/views/default/list_id.html b/views/default/list_id.html
new file mode 100644
index 0000000..5c17246
--- /dev/null
+++ b/views/default/list_id.html
@@ -0,0 +1,25 @@
+{{extend 'layout.html'}}
+
+
+
+
+ Users
+
+
+
+
+ User Id
+ User Name
+
+
+ {{for specification in row:}}
+
+ {{=A(specification.id,_href=URL('list_resources',args=specification.id))}}
+ {{=specification.username}}
+
+ {{pass}}
+
diff --git a/views/default/list_resources.html b/views/default/list_resources.html
new file mode 100644
index 0000000..415110f
--- /dev/null
+++ b/views/default/list_resources.html
@@ -0,0 +1,29 @@
+{{extend 'layout.html'}}
+
+
+
+
+ Resources
+
+
+
+
+ Resource Id
+ Resource Type
+ Resource Qty
+ Resource Owner
+
+
+ {{for specification in row:}}
+
+ {{=specification.resources_id}}
+ {{=specification.resources_type}}
+ {{=specification.resources_qty}}
+ {{=specification.resource_owner.username}}
+
+ {{pass}}
+
From 4d17a315ce347d846e3a4b7963d3bc15707fd077 Mon Sep 17 00:00:00 2001
From: rjzhao1 <44123617+rjzhao1@users.noreply.github.com>
Date: Sun, 25 Nov 2018 20:50:11 -0800
Subject: [PATCH 17/35] Uploaded Category functions
---
controllers/default.py | 38 ++++++++++++++++++++++++++++++++++++--
1 file changed, 36 insertions(+), 2 deletions(-)
diff --git a/controllers/default.py b/controllers/default.py
index ce76715..3f95c64 100644
--- a/controllers/default.py
+++ b/controllers/default.py
@@ -5,19 +5,53 @@
# -------------------------------------------------------------------------
#https://helpmehelpyou/deafult/list_user_resources/user_id/page
+#https://helpmehelpyou/deafult/list_user_resources/category/
+
# ---- example index page ----
def index():
response.flash = T("Hello World")
return dict(message=T('Welcome to HelpYouHelpMe'))
-def list_user_resources():
+def list_resources():
user_id = request.args(0,cast=int)
row=db(db.resources.resource_owner==user_id).select()
return locals()
+def delete_resource():
+ user_id = request.args(0,cast=int)
+ for row in db(db.resources.resource_owner==user_id).select():
+ db(db.resources.resources_id == request.vars.resources_id).delete()
+ row = db(db.resources.resource_owner==user_id).select()
+ return locals()
+
+def list_id():
+ row = db(db.auth_user).select()
+ return locals()
+
+def list_resource_by_category():
+ category_name = request.args(0)
+ category=db.category(Name=category_name)
+ row = db(db.resources.resources_category==category).select()
+ return locals()
+
def add_resources():
- form = SQLFORM(db.resources).process(next=URL(index))
+ user_id = session.auth.user.id
+ db.resources.resource_owner.default = user_id
+ form = SQLFORM(db.resources).process(next='list_user_resources/[resource_owner]')
return locals()
+
+def edit_resources():
+ user_id = request.args(0,cast=int)
+ form = SQLFORM(db.resources,id).process('list_user_resources/[resource_owner]')
+ return locals()
+
+def profile():
+ return dict(form=auth.profile())
+
+def category():
+ row = db(db.category).select()
+ return locals()
+
# ---- API (example) -----
@auth.requires_login()
def api_get_user_email():
From 3275ec80786ee49099257a5cae7f7ad36aa33ff7 Mon Sep 17 00:00:00 2001
From: rjzhao1 <44123617+rjzhao1@users.noreply.github.com>
Date: Sun, 25 Nov 2018 20:51:22 -0800
Subject: [PATCH 18/35] Add files via upload
---
models/db.py | 17 +++++++++++------
models/menu.py | 8 +++++---
2 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/models/db.py b/models/db.py
index af0222f..0e5220f 100644
--- a/models/db.py
+++ b/models/db.py
@@ -59,7 +59,7 @@
# -------------------------------------------------------------------------
# choose a style for forms
# -------------------------------------------------------------------------
-response.formstyle = 'bootstrap4_inline'
+response.formstyle = 'table3cols'
response.form_label_separator = ''
# -------------------------------------------------------------------------
@@ -90,10 +90,11 @@
# create all tables needed by auth, maybe add a list of extra fields
# -------------------------------------------------------------------------
-auth.settings.extra_fields['auth_user']= [
- Field('user_address', type='string'),
- Field('latitude', type='integer'),
- Field('longitude', type='integer')]
+auth.settings.extra_fields['resources']= [
+ Field('resource_1', type='string'),
+ Field('resource_2', type='string'),
+ Field('resource_3', type='string'),
+ Field ('resource_4', type='string')]
auth.define_tables(username=True, signature=False)
@@ -139,12 +140,16 @@
# Define your tables below (or better in another model file) for example
#
+db.define_table('category', Field('Name',type='string'),
+ format='%(Name)s')
+
db.define_table('resources',
Field('resources_id', type='integer', unique=True),
Field('resources_type', type='string'),
Field('resources_qty', type='integer'),
- Field('resource_owner', type='reference auth_user'))
+ Field('resources_category',type = 'reference category'),
+ Field('resource_owner', type='reference auth_user',writable=False))
db.define_table('pooltable',
Field('pooltable_id', type='integer', unique=True),
diff --git a/models/menu.py b/models/menu.py
index 07f38c9..0e4bc8c 100644
--- a/models/menu.py
+++ b/models/menu.py
@@ -15,9 +15,11 @@
response.menu += [
(T('Resources'), False,'#', [
- (T('View'), False,URL('list_resources',args = user_id)),
- (T('Add'), False, URL('add_resources')),
- (T('Other'), False, URL('list_id'))]
+ (T('My Resource'), False,URL('list_resources',args = user_id) if session.auth else URL('default','index')),
+ ((T('Add Resources'), False, URL('add_resources') if session.auth else URL('default','index'))),
+ (T('List Users'), False, URL('list_id')),
+ (T('Delete Resources'), False, URL('delete_resource',args = user_id) if session.auth else URL('default','index')),
+ (T('Category'),False,URL('category'))]
)
]
# ----------------------------------------------------------------------------------------------------------------------
From ae4097dfe7030753eafddbe38e71d779295d86b4 Mon Sep 17 00:00:00 2001
From: rjzhao1 <44123617+rjzhao1@users.noreply.github.com>
Date: Sun, 25 Nov 2018 20:52:46 -0800
Subject: [PATCH 19/35] Categories
Added Simple Category database and Tabs for categories
From 65b13a51b03fe6625d92642a4394921e42f19f19 Mon Sep 17 00:00:00 2001
From: rjzhao1 <44123617+rjzhao1@users.noreply.github.com>
Date: Wed, 28 Nov 2018 18:18:36 -0800
Subject: [PATCH 20/35] Made some changes to Category
---
models/menu.py | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/models/menu.py b/models/menu.py
index 0e4bc8c..e50aeda 100644
--- a/models/menu.py
+++ b/models/menu.py
@@ -18,10 +18,15 @@
(T('My Resource'), False,URL('list_resources',args = user_id) if session.auth else URL('default','index')),
((T('Add Resources'), False, URL('add_resources') if session.auth else URL('default','index'))),
(T('List Users'), False, URL('list_id')),
- (T('Delete Resources'), False, URL('delete_resource',args = user_id) if session.auth else URL('default','index')),
- (T('Category'),False,URL('category'))]
+ (T('Delete Resources'), False, URL('delete_resource',args = user_id) if session.auth else URL('default','index'))
+ ]
)
]
+
+response.menu += [
+ ((T('Category'),False, '#', [
+ (T(row.Name), False, URL('list_resource_by_category',args=row.Name), []) for row in db(db.category).select()]))
+]
# ----------------------------------------------------------------------------------------------------------------------
# provide shortcuts for development. you can remove everything below in production
# ----------------------------------------------------------------------------------------------------------------------
From 6e2a64bf58e3481ef240d2a1d8ef3d552f6a2f06 Mon Sep 17 00:00:00 2001
From: rjzhao1 <44123617+rjzhao1@users.noreply.github.com>
Date: Wed, 28 Nov 2018 18:25:45 -0800
Subject: [PATCH 21/35] Added all html pages
---
views/default/delete_resource.html | 37 ++++++++++
views/default/edit_resource.html | 35 ++++++++++
views/default/index.html | 72 ++++++--------------
views/default/list_id.html | 2 +-
views/default/list_resource_by_category.html | 32 +++++++++
views/default/list_resources.html | 3 +-
views/default/profile.html | 7 ++
views/default/user.html | 66 +++++++++---------
8 files changed, 168 insertions(+), 86 deletions(-)
create mode 100644 views/default/delete_resource.html
create mode 100644 views/default/edit_resource.html
create mode 100644 views/default/list_resource_by_category.html
create mode 100644 views/default/profile.html
diff --git a/views/default/delete_resource.html b/views/default/delete_resource.html
new file mode 100644
index 0000000..9284a2a
--- /dev/null
+++ b/views/default/delete_resource.html
@@ -0,0 +1,37 @@
+{{extend 'layout.html'}}
+{{extend 'layout.html'}}
+
+
+
+
+
+
+
+ Resource Id
+ Resource Type
+ Category
+ Resource Qty
+ Resource Owner
+
+
+
+ {{for specification in row:}}
+
+ {{=specification.resources_id}}
+ {{=specification.resources_type}}
+ {{=specification.resources_qty}}
+ {{=specification.resource_owner.username}}
+
+ {{pass}}
+
+
+Delete resource
+
+
diff --git a/views/default/edit_resource.html b/views/default/edit_resource.html
new file mode 100644
index 0000000..4815c50
--- /dev/null
+++ b/views/default/edit_resource.html
@@ -0,0 +1,35 @@
+{{extend 'layout.html'}}
+ Edit resource
+
+
+
+
+
+
+
+
+ Resource Id
+ Resource Type
+ Resource Qty
+ Resource Owner
+
+
+ {{for specification in specifications:}}
+
+ {{=specification.resources_id}}
+ {{=specification.resources_type}}
+ {{=specification.resources_qty}}
+ {{=specification.resource_owner.username}}
+
+ {{pass}}
+
diff --git a/views/default/index.html b/views/default/index.html
index 9107d64..b5d3a31 100644
--- a/views/default/index.html
+++ b/views/default/index.html
@@ -1,51 +1,21 @@
-{{extend 'layout.html'}}
-
-{{block header}}
-
-
-
/{{=request.application}}/{{=request.controller}}/{{=request.function}}
-
-
-{{end}}
-
-
-
- {{if 'message' in globals():}}
-
{{=message}}
-
{{=T('How did you get here?')}}
-
- {{=T('You are successfully running web2py')}}
- {{=XML(T('You visited the url %s', A(request.env.path_info,_href=request.env.path_info)))}}
- {{=XML(T('Which called the function %s located in the file %s',
- (A(request.function+'()',_href='#'),
- A('web2py/applications/%(application)s/controllers/%(controller)s.py' % request,
- _href=URL('admin','default','peek', args=(request.application,'controllers',request.controller+'.py'))))))}}
- {{=XML(T('The output of the file is a dictionary that was rendered by the view %s',
- A('web2py/applications/%(application)s/views/%(controller)s/index.html' % request,
- _href=URL('admin','default','peek',args=(request.application,'views',request.controller,'index.html')))))}}
- {{=T('You can modify this application and adapt it to your needs')}}
-
-
- {{elif 'content' in globals():}}
- {{=content}}
- {{else:}}
- {{=BEAUTIFY(response._vars)}}
- {{pass}}
-
-
-
-
-
+{{extend 'layout.html'}}
+
+{{block header}}
+
+{{end}}
+
+
+
+ {{if 'message' in globals():}}
+
{{=message}}
+ {{elif 'content' in globals():}}
+ {{=content}}
+ {{else:}}
+ {{=BEAUTIFY(response._vars)}}
+ {{pass}}
+
+
diff --git a/views/default/list_id.html b/views/default/list_id.html
index 5c17246..9a28e84 100644
--- a/views/default/list_id.html
+++ b/views/default/list_id.html
@@ -18,7 +18,7 @@
{{for specification in row:}}
- {{=A(specification.id,_href=URL('list_resources',args=specification.id))}}
+ {{=A(specification.id,_href=URL('category',args=specification.id))}}
{{=specification.username}}
{{pass}}
diff --git a/views/default/list_resource_by_category.html b/views/default/list_resource_by_category.html
new file mode 100644
index 0000000..6ad48f0
--- /dev/null
+++ b/views/default/list_resource_by_category.html
@@ -0,0 +1,32 @@
+{{extend 'layout.html'}}
+
+
+
+
+
+ {{=category_name}}
+
+
+
+
+ Resource Id
+ Resource Type
+ Resource Category
+ Resource Qty
+ Resource Owner
+
+
+ {{for specification in row:}}
+
+ {{=specification.resources_id}}
+ {{=specification.resources_type}}
+ {{=specification.resources_category.Name}}
+ {{=specification.resources_qty}}
+ {{=specification.resource_owner.username}}
+
+ {{pass}}
+
diff --git a/views/default/list_resources.html b/views/default/list_resources.html
index 415110f..5f493ba 100644
--- a/views/default/list_resources.html
+++ b/views/default/list_resources.html
@@ -7,7 +7,7 @@
- Resources
+ Resources
@@ -22,6 +22,7 @@
{{=specification.resources_id}}
{{=specification.resources_type}}
+ {{=specification.resources_category}}
{{=specification.resources_qty}}
{{=specification.resource_owner.username}}
diff --git a/views/default/profile.html b/views/default/profile.html
new file mode 100644
index 0000000..c8180fc
--- /dev/null
+++ b/views/default/profile.html
@@ -0,0 +1,7 @@
+{{extend 'layout.html'}}
+ User Profile
+
+
diff --git a/views/default/user.html b/views/default/user.html
index e6635ae..d947a07 100644
--- a/views/default/user.html
+++ b/views/default/user.html
@@ -1,33 +1,33 @@
-{{extend 'layout.html'}}
-
-
-
-
-
-{{block page_js}}
-
-{{end page_js}}
+{{extend 'layout.html'}}
+
+
+
+
+
+{{block page_js}}
+
+{{end page_js}}
From a57a3d5809afd435f24e602019d6873994b5071d Mon Sep 17 00:00:00 2001
From: rjzhao1 <44123617+rjzhao1@users.noreply.github.com>
Date: Wed, 28 Nov 2018 18:31:01 -0800
Subject: [PATCH 22/35] edit to menu
---
menu.py | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/menu.py b/menu.py
index 07f38c9..79e8cd9 100644
--- a/menu.py
+++ b/menu.py
@@ -15,11 +15,18 @@
response.menu += [
(T('Resources'), False,'#', [
- (T('View'), False,URL('list_resources',args = user_id)),
- (T('Add'), False, URL('add_resources')),
- (T('Other'), False, URL('list_id'))]
+ (T('My Resource'), False,URL('list_resources',args = user_id) if session.auth else URL('default','index')),
+ (T('List Users'), False, URL('list_id')),
+ ((T('Add Resources'), False, URL('add_resources') if session.auth else URL('default','index'))),
+ (T('Delete Resources'), False, URL('delete_resource',args = user_id) if session.auth else URL('default','index'))
+ ]
)
]
+
+response.menu += [
+ ((T('Category'),False, '#', [
+ (T(row.Name), False, URL('list_resource_by_category',args=row.Name), []) for row in db(db.category).select()]))
+]
# ----------------------------------------------------------------------------------------------------------------------
# provide shortcuts for development. you can remove everything below in production
# ----------------------------------------------------------------------------------------------------------------------
From f65da4f5036803361c439581f8f16e8962b8409b Mon Sep 17 00:00:00 2001
From: rjzhao1 <44123617+rjzhao1@users.noreply.github.com>
Date: Wed, 28 Nov 2018 18:57:12 -0800
Subject: [PATCH 23/35] Add files via upload
---
views/default/search_resource.html | 3 +++
1 file changed, 3 insertions(+)
create mode 100644 views/default/search_resource.html
diff --git a/views/default/search_resource.html b/views/default/search_resource.html
new file mode 100644
index 0000000..76f348d
--- /dev/null
+++ b/views/default/search_resource.html
@@ -0,0 +1,3 @@
+{{extend 'layout.html'}}
+Search Resources
+{{=BEAUTIFY(response._vars)}}
From b2f0ccf08af72db7578e8ad05af85190a97ae558 Mon Sep 17 00:00:00 2001
From: rjzhao1 <44123617+rjzhao1@users.noreply.github.com>
Date: Fri, 30 Nov 2018 10:52:04 -0800
Subject: [PATCH 24/35] Change add resource form
---
models/db.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/models/db.py b/models/db.py
index 0e5220f..c7ae2fc 100644
--- a/models/db.py
+++ b/models/db.py
@@ -59,7 +59,7 @@
# -------------------------------------------------------------------------
# choose a style for forms
# -------------------------------------------------------------------------
-response.formstyle = 'table3cols'
+response.formstyle = 'bootstrap3_stacked'
response.form_label_separator = ''
# -------------------------------------------------------------------------
From 2bac9b7815c599c5de7077a983959a62b2c98d14 Mon Sep 17 00:00:00 2001
From: rjzhao1 <44123617+rjzhao1@users.noreply.github.com>
Date: Fri, 30 Nov 2018 10:53:01 -0800
Subject: [PATCH 25/35] removed search bars and added images
---
views/layout.html | 260 +++++++++++++++++++++++-----------------------
1 file changed, 129 insertions(+), 131 deletions(-)
diff --git a/views/layout.html b/views/layout.html
index 5643dfd..9893554 100644
--- a/views/layout.html
+++ b/views/layout.html
@@ -1,131 +1,129 @@
-
-
-
-
-
-
-
-
-
- {{=response.title or request.application}}
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{include 'web2py_ajax.html'}}
- {{block head}}{{end}}
-
-
- {{=response.flash or ''}}
-
-
- web2py
-
-
-
-
-
- {{for _item in response.menu or []:}}
- {{if len(_item)<4 or not _item[3]:}}
-
- {{=_item[0]}}
-
- {{else:}}
-
- {{=_item[0]}}
-
-
- {{pass}}
- {{pass}}
-
-
- {{if 'auth' in globals():}}
-
- {{pass}}
-
-
-
-
- {{block header}}
- {{end}}
-
-
-
- {{include}}
- {{=response.toolbar() if response.show_toolbar else ''}}
-
-
- {{block footer}}
-
- {{end}}
-
-
-
- {{block page_js}}{{end page_js}}
- {{if response.google_analytics_id:}}
-
-
-
- {{pass}}
-
-
+
+
+
+
+
+
+
+
+ {{=response.title or request.application}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{include 'web2py_ajax.html'}}
+ {{block head}}{{end}}
+
+
+ {{=response.flash or ''}}
+
+
+ HelpMeHelpYou
+
+
+
+
+
+ {{for _item in response.menu or []:}}
+ {{if len(_item)<4 or not _item[3]:}}
+
+ {{=_item[0]}}
+
+ {{else:}}
+
+ {{=_item[0]}}
+
+
+ {{pass}}
+ {{pass}}
+
+
+ {{if 'auth' in globals():}}
+
+ {{pass}}
+
+
+
+
+
+ {{block header}}
+ {{end}}
+
+
+
+ {{include}}
+ {{=response.toolbar() if response.show_toolbar else ''}}
+
+
+ {{block footer}}
+
+ {{end}}
+
+
+
+ {{block page_js}}{{end page_js}}
+ {{if response.google_analytics_id:}}
+
+
+
+ {{pass}}
+
+
From 12690ccef33247a82de77a810096f88c6cfa6318 Mon Sep 17 00:00:00 2001
From: rjzhao1 <44123617+rjzhao1@users.noreply.github.com>
Date: Fri, 30 Nov 2018 10:53:27 -0800
Subject: [PATCH 26/35] added images
---
views/default/index.html | 111 +++++++++++++++++++++++++++++++--------
1 file changed, 90 insertions(+), 21 deletions(-)
diff --git a/views/default/index.html b/views/default/index.html
index b5d3a31..fe00263 100644
--- a/views/default/index.html
+++ b/views/default/index.html
@@ -1,21 +1,90 @@
-{{extend 'layout.html'}}
-
-{{block header}}
-
-{{end}}
-
-
-
- {{if 'message' in globals():}}
-
{{=message}}
- {{elif 'content' in globals():}}
- {{=content}}
- {{else:}}
- {{=BEAUTIFY(response._vars)}}
- {{pass}}
-
-
+
+
+
+
+
+
+
+
+
+
+ Sign up - HelpMeHelpYou
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{for specification in row:}}
- {{=specification.resources_id}}
+ {{=A(specification.resources_id,_href=URL('list_single_resource',args=specification.resources_id))}}
{{=specification.resources_type}}
{{=specification.resources_category.Name}}
{{=specification.resources_qty}}
diff --git a/views/default/list_resources.html b/views/default/list_resources.html
index 5f493ba..bc7701f 100644
--- a/views/default/list_resources.html
+++ b/views/default/list_resources.html
@@ -14,13 +14,14 @@
Resource Id
Resource Type
+ Resource Category
Resource Qty
Resource Owner
{{for specification in row:}}
- {{=specification.resources_id}}
+ {{=A(specification.resources_id,_href=URL('list_single_resource',args=specification.resources_id))}}
{{=specification.resources_type}}
{{=specification.resources_category}}
{{=specification.resources_qty}}
diff --git a/views/default/list_single_resource.html b/views/default/list_single_resource.html
new file mode 100644
index 0000000..bc7701f
--- /dev/null
+++ b/views/default/list_single_resource.html
@@ -0,0 +1,31 @@
+{{extend 'layout.html'}}
+
+
+
+
+ Resources
+
+
+
+
+ Resource Id
+ Resource Type
+ Resource Category
+ Resource Qty
+ Resource Owner
+
+
+ {{for specification in row:}}
+
+ {{=A(specification.resources_id,_href=URL('list_single_resource',args=specification.resources_id))}}
+ {{=specification.resources_type}}
+ {{=specification.resources_category}}
+ {{=specification.resources_qty}}
+ {{=specification.resource_owner.username}}
+
+ {{pass}}
+
diff --git a/views/default/search_resource.html b/views/default/search_resource.html
index 76f348d..3c8f9de 100644
--- a/views/default/search_resource.html
+++ b/views/default/search_resource.html
@@ -1,3 +1,23 @@
{{extend 'layout.html'}}
Search Resources
-{{=BEAUTIFY(response._vars)}}
+{{=form}}
+
+
+
+ Resource Id
+ Resource Type
+ Resource Category
+ Resource Qty
+ Resource Owner
+
+
+ {{for specification in result:}}
+
+ {{=A(specification.resources_id,_href=URL('list_single_resource',args=specification.resources_id))}}
+ {{=specification.resources_type}}
+ {{=specification.resources_category}}
+ {{=specification.resources_qty}}
+ {{=specification.resource_owner.username}}
+
+ {{pass}}
+
From a6f557571d7ca4ac819a98ddd28536f5686e7395 Mon Sep 17 00:00:00 2001
From: rjzhao1 <44123617+rjzhao1@users.noreply.github.com>
Date: Sat, 1 Dec 2018 00:30:40 -0800
Subject: [PATCH 30/35] fixed bug for add resources
---
controllers/default.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/controllers/default.py b/controllers/default.py
index 0226892..7f1f23a 100644
--- a/controllers/default.py
+++ b/controllers/default.py
@@ -20,7 +20,7 @@ def list_resources():
def delete_resource():
user_id = request.args(0,cast=int)
db(db.resources.resources_id == request.vars.resources_id).delete()
- specifications = db(db.resources.resource_owner==user_id).select()
+ row = db(db.resources.resource_owner==user_id).select()
return locals()
def list_id():
@@ -36,7 +36,7 @@ def list_resource_by_category():
def add_resources():
user_id = session.auth.user.id
db.resources.resource_owner.default = user_id
- form = SQLFORM(db.resources).process(next='list_user_resources/[resource_owner]')
+ form = SQLFORM(db.resources).process(next=URL('list_resources',args = user_id))
return locals()
def edit_resource():
From 8a464d598eac5d37101da4cc657a90fb2fe7df91 Mon Sep 17 00:00:00 2001
From: rjzhao1 <44123617+rjzhao1@users.noreply.github.com>
Date: Sat, 1 Dec 2018 00:36:42 -0800
Subject: [PATCH 31/35] Fixed bug for Delete resources
---
views/default/delete_resource.html | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/views/default/delete_resource.html b/views/default/delete_resource.html
index 9284a2a..3c6185f 100644
--- a/views/default/delete_resource.html
+++ b/views/default/delete_resource.html
@@ -1,5 +1,13 @@
{{extend 'layout.html'}}
-{{extend 'layout.html'}}
+
+Delete resource
+
+ Resource Id:
+
+
+
+
+