Major by improvements
parent
57bccb4cf7
commit
12db849a02
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,12 +1,24 @@
|
||||
from .models import Task
|
||||
from .models import Task, Status
|
||||
from django.contrib.auth.models import AnonymousUser
|
||||
|
||||
def utilities(request):
|
||||
if request.user.is_superuser:
|
||||
|
||||
|
||||
if request.user.is_authenticated and 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:
|
||||
last_status = Status.objects.filter(staff=request.user.staffprofile).last()
|
||||
elif request.user.is_authenticated:
|
||||
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()
|
||||
last_status = Status.objects.filter(staff=request.user.staffprofile).last()
|
||||
else:
|
||||
# Handle the case when the user is not logged in
|
||||
open_task_count = 0
|
||||
working_on_task_count = 0
|
||||
last_status = None
|
||||
|
||||
total_tasks = open_task_count + working_on_task_count
|
||||
return {'total_tasks': total_tasks}
|
||||
latest_statuses = Status.objects.all().order_by('-id')[:12]
|
||||
|
||||
return {'total_tasks': total_tasks, 'last_status' : last_status, 'latest_statuses' : latest_statuses, }
|
||||
|
@ -0,0 +1,17 @@
|
||||
# Generated by Django 4.2.5 on 2023-09-21 07:02
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('osinacore', '0027_alter_status_staff'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='projecttype',
|
||||
name='color',
|
||||
),
|
||||
]
|
@ -0,0 +1,18 @@
|
||||
# Generated by Django 4.2.5 on 2023-09-21 07:09
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('osinacore', '0028_remove_projecttype_color'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='reference',
|
||||
name='date',
|
||||
field=models.CharField(max_length=200),
|
||||
),
|
||||
]
|
@ -0,0 +1,20 @@
|
||||
# Generated by Django 4.2.5 on 2023-09-21 07:24
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('osinacore', '0029_alter_reference_date'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Tag',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=50)),
|
||||
],
|
||||
),
|
||||
]
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 48 KiB |
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
Loading…
Reference in New Issue