adilmohak / django-lms

A learning management system using django web framework. Course add and drop, grade and assessment result management, online quiz, report generator, student and lecturers management, dashboard, and so much more...
MIT License
584 stars 251 forks source link

Dashboard showing: AttributeError at /dashboard/ #34

Closed mcassano closed 7 months ago

mcassano commented 8 months ago

Describe the bug Fresh installation from HEAD, add a student, click "Dashboard" and Django error "AttributeError at /dashboard/"

To Reproduce Steps to reproduce the behavior: Described above

Expected behavior Expected to see the dashboard, got an error:

AttributeError: 'CustomUserManager' object has no attribute 'get_student_count'
ERROR 2024-03-08 16:56:14,143 log 6923 6159986688 Internal Server Error: /dashboard/
Traceback (most recent call last):
  File "/Users/mike/django-lms/.venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mike/django-lms/.venv/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mike/django-lms/.venv/lib/python3.11/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view
    return view_func(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mike/django-lms/accounts/decorators.py", line 23, in wrapper
    return function(request, *args, **kwargs) if function else None
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mike/django-lms/core/views.py", line 30, in dashboard_view
    "student_count": User.objects.get_student_count(),
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'CustomUserManager' object has no attribute 'get_student_count'