diff --git a/osinaweb/db.sqlite3 b/osinaweb/db.sqlite3 index 83ef60fd..6f2d663a 100644 Binary files a/osinaweb/db.sqlite3 and b/osinaweb/db.sqlite3 differ diff --git a/osinaweb/osinacore/__pycache__/admin.cpython-310.pyc b/osinaweb/osinacore/__pycache__/admin.cpython-310.pyc index 168b2481..6e555c86 100644 Binary files a/osinaweb/osinacore/__pycache__/admin.cpython-310.pyc and b/osinaweb/osinacore/__pycache__/admin.cpython-310.pyc differ diff --git a/osinaweb/osinacore/__pycache__/views.cpython-310.pyc b/osinaweb/osinacore/__pycache__/views.cpython-310.pyc index c601feec..d271e306 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/admin.py b/osinaweb/osinacore/admin.py index 491a4ec2..7e36521a 100644 --- a/osinaweb/osinacore/admin.py +++ b/osinaweb/osinacore/admin.py @@ -31,5 +31,6 @@ admin.site.register(Epic) admin.site.register(Note) admin.site.register(Task) admin.site.register(Status) +admin.site.register(Tag) diff --git a/osinaweb/osinacore/views.py b/osinaweb/osinacore/views.py index bde28faf..63c43e08 100644 --- a/osinaweb/osinacore/views.py +++ b/osinaweb/osinacore/views.py @@ -47,7 +47,7 @@ def signout(request): @login_required def home(request, *args, **kwargs): notes = Note.objects.filter(user=request.user).order_by('-date')[:6] - recent_note = Note.objects.last() + recent_note = Note.objects.filter(user=request.user).last() if request.user.is_superuser: # Superadmin can see the last 8 tasks for all users @@ -78,13 +78,13 @@ def home(request, *args, **kwargs): def my_projects(request, *args, **kwargs): user = request.user - try: - staff_profile = StaffProfile.objects.get(user=user) - - projects = Project.objects.filter(models.Q(manager=staff_profile) | models.Q(members=staff_profile)).distinct().order_by('-project_id') + if user.is_superuser: + # Superadmin can see all projects + projects = Project.objects.all() + else: + # Non-superuser, filter projects where the user is either the manager or a member + projects = Project.objects.filter(Q(manager=user.staffprofile) | Q(members=user.staffprofile)).distinct() - except StaffProfile.DoesNotExist: - projects = [] context = { diff --git a/osinaweb/templates/main.html b/osinaweb/templates/main.html index f6ace2b2..e4e879f0 100644 --- a/osinaweb/templates/main.html +++ b/osinaweb/templates/main.html @@ -108,7 +108,7 @@
-

Staff Profiles

+

Staffs