diff --git a/mysql/sql/init.sql b/mysql/sql/init.sql
index 0852695..438e924 100644
--- a/mysql/sql/init.sql
+++ b/mysql/sql/init.sql
@@ -132,7 +132,9 @@ CREATE TABLE task_offer (
insert into users values (NULL, "admin", "password", "Admin Modsen", "ntnu", 'mail@ntnu.no',"12345678", "street", "trondheim", "trondheim", "1234", "norway");
-insert into project_category values (NULL, "Test Category");
+insert into project_category values (NULL, "Gardening");
+insert into project_category values (NULL, "Programming");
+insert into project_category values (NULL, "Grocery shopping");
/*
diff --git a/src/app/models/database.py b/src/app/models/database.py
index 771bf4d..d3ef6df 100644
--- a/src/app/models/database.py
+++ b/src/app/models/database.py
@@ -3,8 +3,8 @@ import mysql.connector
db = mysql.connector.connect(
user='root',
password='root',
- #host='10.5.0.5', # Docker address
- host='0.0.0.0', # Local address
+ host='10.5.0.5', # Docker address
+ #host='0.0.0.0', # Local address
database='db'
)
\ No newline at end of file
diff --git a/src/app/requirements.txt b/src/app/requirements.txt
index ba9cecb..c8ba3f5 100644
--- a/src/app/requirements.txt
+++ b/src/app/requirements.txt
@@ -1,3 +1,2 @@
web.py==0.40
mysql-connector==2.2.9
-flask
diff --git a/src/app/templates/index.html b/src/app/templates/index.html
index 5c02157..1f5f5e2 100644
--- a/src/app/templates/index.html
+++ b/src/app/templates/index.html
@@ -27,6 +27,10 @@ $def with (nav, project_bulk_one, project_bulk_two, projects, categories)
$if projects == 'my':
Your open projects
+ $elif projects == 'customer':
+ Customer projects in progress
+ $elif projects == 'finished':
+ My finished projects
$for project in project_bulk_one:
@@ -35,6 +39,8 @@ $def with (nav, project_bulk_one, project_bulk_two, projects, categories)
$if projects == 'my':
Projects in progress
+ $elif projects == 'finished':
+
Finished customer projects
$for project in project_bulk_two:
diff --git a/src/app/views/forms.py b/src/app/views/forms.py
index d99f5cb..282fb23 100644
--- a/src/app/views/forms.py
+++ b/src/app/views/forms.py
@@ -82,6 +82,20 @@ def get_project_form_elements(project_title="", project_description="", category
return project_form_elements
def get_user_form_elements(identifier=0, user_name="", read_permission=True, write_permission=False, modify_permission=False):
+ """
+ Get the user form elements used to set users in project upon creation
+ :param identifier: The id of this element
+ :param user_name: The current user
+ :param read_permission: Permit user to read
+ :param write_permission: Permit user to write
+ :param modify_permission: Permit user to modify
+ :type identifier: int
+ :type user_name: str
+ :type read_permission: bool
+ :type write_permission: bool
+ :type modify_permission: bool
+ :return: The form elements to add users to a project
+ """
user_form_elements = (
form.Textbox("user_name_" + str(identifier), description="User", value=user_name),
form.Checkbox("read_permission_" + str(identifier), description="Read Permission", checked=read_permission, value=True),
@@ -100,6 +114,10 @@ project_buttons = form.Form(
)
def get_apply_form():
+ """
+ Get the form used to add users to an application and apply
+ :return: A form object
+ """
users = get_users()
apply_form = form.Form(
form.Dropdown("user_to_add", description="User", args=users),
@@ -109,6 +127,20 @@ def get_apply_form():
return apply_form
def get_apply_permissions_form(identifier=0, read_permission="TRUE", write_permission="FALSE", modify_permission="FALSE", userid=None):
+ """
+ Get the form used to set permissions for each applicant
+ :param identifier: The id of this element
+ :param user_name: The current user
+ :param read_permission: Permit user to read
+ :param write_permission: Permit user to write
+ :param modify_permission: Permit user to modify
+ :type identifier: int
+ :type user_name: str
+ :type read_permission: bool
+ :type write_permission: bool
+ :type modify_permission: bool
+ :return: A form object
+ """
user_permissions = form.Form(
form.Button("remove_user", type="submit", description="User to remove", value=userid, html="X"),
form.Hidden("user_"+str(identifier), description="User to apply for project", value=userid),