diff --git a/osinaweb/db.sqlite3 b/osinaweb/db.sqlite3
index b86864c9..aaf759d5 100644
Binary files a/osinaweb/db.sqlite3 and b/osinaweb/db.sqlite3 differ
diff --git a/osinaweb/osinacore/__pycache__/custom_context.cpython-310.pyc b/osinaweb/osinacore/__pycache__/custom_context.cpython-310.pyc
new file mode 100644
index 00000000..0ad9bf7f
Binary files /dev/null and b/osinaweb/osinacore/__pycache__/custom_context.cpython-310.pyc differ
diff --git a/osinaweb/osinacore/__pycache__/views.cpython-310.pyc b/osinaweb/osinacore/__pycache__/views.cpython-310.pyc
index c9ecf6c2..bee27ee6 100644
Binary files a/osinaweb/osinacore/__pycache__/views.cpython-310.pyc and b/osinaweb/osinacore/__pycache__/views.cpython-310.pyc differ
diff --git a/osinaweb/osinacore/custom_context.py b/osinaweb/osinacore/custom_context.py
new file mode 100644
index 00000000..c050d67c
--- /dev/null
+++ b/osinaweb/osinacore/custom_context.py
@@ -0,0 +1,12 @@
+from .models import Task
+
+def utilities(request):
+ if request.user.is_superuser:
+ open_task_count = Task.objects.filter(status='Open').count()
+ working_on_task_count = Task.objects.filter(status='Working On').count()
+ else:
+ open_task_count = Task.objects.filter(assigned_to=request.user.staffprofile, status='Open').count()
+ working_on_task_count = Task.objects.filter(assigned_to=request.user.staffprofile, status='Working On').count()
+
+ total_tasks = open_task_count + working_on_task_count
+ return {'total_tasks': total_tasks}
\ No newline at end of file
diff --git a/osinaweb/osinacore/views.py b/osinaweb/osinacore/views.py
index df1b7642..22bbd912 100644
--- a/osinaweb/osinacore/views.py
+++ b/osinaweb/osinacore/views.py
@@ -53,15 +53,10 @@ def home(request, *args, **kwargs):
if request.user.is_superuser:
# Superadmin can see the last 8 tasks for all users
tasks = Task.objects.filter(Q(status='Open') | Q(status='Working On')).order_by('-id')[:8]
- open_task_count = Task.objects.filter(status='Open').count()
- working_on_task_count = Task.objects.filter(status='Working On').count()
- total_tasks = open_task_count + working_on_task_count
+
else:
# Non-superadmin user can only see their assigned tasks
tasks = Task.objects.filter(Q(assigned_to=request.user.staffprofile) & (Q(status='Open') | Q(status='Working On')))
- open_task_count = Task.objects.filter(assigned_to=request.user.staffprofile,status='Open').count()
- working_on_task_count = Task.objects.filter(assigned_to=request.user.staffprofile, status='Working On').count()
- total_tasks = open_task_count + working_on_task_count
# Initialize last_note_color with a default color
last_note_color = 'black'
@@ -74,7 +69,6 @@ def home(request, *args, **kwargs):
'notes': notes,
'recent_note': recent_note,
'tasks': tasks,
- 'total_tasks' :total_tasks,
'last_note_color': last_note_color,
}
@@ -661,8 +655,8 @@ def save_customer(request):
form = SignUpForm(request.POST)
if form.is_valid():
email = form.cleaned_data['email']
- first_name = form.cleaned_data['first_name'].replace(" ", "") # Remove spaces
- last_name = form.cleaned_data['last_name'].replace(" ", "") # Remove spaces
+ first_name = form.cleaned_data['first_name'].replace(" ", "")
+ last_name = form.cleaned_data['last_name'].replace(" ", "")
username = f"{first_name.lower()}{last_name.lower()}"
original_username = username
diff --git a/osinaweb/osinaweb/__pycache__/settings.cpython-310.pyc b/osinaweb/osinaweb/__pycache__/settings.cpython-310.pyc
index 90303bd9..9eb08cb0 100644
Binary files a/osinaweb/osinaweb/__pycache__/settings.cpython-310.pyc and b/osinaweb/osinaweb/__pycache__/settings.cpython-310.pyc differ
diff --git a/osinaweb/osinaweb/__pycache__/urls.cpython-310.pyc b/osinaweb/osinaweb/__pycache__/urls.cpython-310.pyc
index c0946bef..2e397fbd 100644
Binary files a/osinaweb/osinaweb/__pycache__/urls.cpython-310.pyc and b/osinaweb/osinaweb/__pycache__/urls.cpython-310.pyc differ
diff --git a/osinaweb/osinaweb/settings.py b/osinaweb/osinaweb/settings.py
index b49ea666..46b5bcdc 100644
--- a/osinaweb/osinaweb/settings.py
+++ b/osinaweb/osinaweb/settings.py
@@ -65,6 +65,7 @@ TEMPLATES = [
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
+ 'osinacore.custom_context.utilities',
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
diff --git a/osinaweb/osinaweb/urls.py b/osinaweb/osinaweb/urls.py
index 24619eb4..fbbe56ef 100644
--- a/osinaweb/osinaweb/urls.py
+++ b/osinaweb/osinaweb/urls.py
@@ -65,6 +65,7 @@ urlpatterns = [
path('addtag/', views.add_tag_modal, name='addtag'),
path('addbusinesscustomer/', views.add_business_modal, name='addbusinesscustomer'),
+
# Save Urls
path('save_note/', views.save_note, name='save_note'),
path('save_project/', views.save_project, name='save_project'),
diff --git a/osinaweb/templates/add-customer.html b/osinaweb/templates/add-customer.html
index 51792cbe..48a6124e 100644
--- a/osinaweb/templates/add-customer.html
+++ b/osinaweb/templates/add-customer.html
@@ -23,7 +23,7 @@
-