Giter Club home page Giter Club logo

adilmohak / django-lms Goto Github PK

View Code? Open in Web Editor NEW
469.0 9.0 195.0 8.51 MB

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...

License: MIT License

Python 55.14% SCSS 3.58% JavaScript 0.53% HTML 40.74%
django learning-management-system python student student-management-system grade-calculator lecturer school-management-system college-management-system university-management-system

django-lms's Introduction

Learning management system using django web framework

Feature-rich learning management system. You may want to build a learning management system(AKA school management system) for a school organization or just for the sake of learning the tech stack and building your portfolio, either way, this project would be a good kickstart for you.

Let's enhance the project by contributing! πŸ‘©β€πŸ’»πŸ‘©β€πŸ’»

Screenshot from 2023-12-31 17-36-31

Current features

  • Dashboard: School demographics and analytics. Restricted to only admins
  • News And Events: All users can access this page
  • Admin manages students(Add, Update, Delete)
  • Admin manages lecturers(Add, Update, Delete)
  • Students can Add and Drop courses
  • Lecturers submit students' scores: Attendance, Mid exam, Final exam, assignment
  • The system calculates students' Total, average, point, and grades automatically
  • Grade comment for each student with a pass, fail, or pass with a warning
  • Assessment result page for students
  • Grade result page for students
  • Session/year and semester management
  • Assessments and grades will be grouped by semester
  • Upload video and documentation for each course
  • PDF generator for students' registration slip and grade result
  • Page access restriction
  • Storing of quiz results under each user
  • Question order randomization
  • Previous quiz scores can be viewed on the category page
  • Correct answers can be shown after each question or all at once at the end
  • Logged-in users can return to an incomplete quiz to finish it and non-logged-in users can complete a quiz if their session persists
  • The quiz can be limited to one attempt per user
  • Questions can be given a category
  • Success rate for each category can be monitored on a progress page
  • Explanation for each question result can be given
  • Pass marks can be set
  • Multiple choice question type
  • True/False question type
  • Essay question type
  • Custom message displayed for those that pass or fail a quiz
  • Custom permission (view_sittings) added, allowing users with that permission to view quiz results from users
  • A marking page which lists completed quizzes, can be filtered by quiz or user, and is used to mark essay questions

Quick note for future contributors

If you would like to contribute, simply begin by implementing one from the list in the TODO.md file.

Requirements:

The following programs are required to run the project

Installation

  • Clone the repo with
git clone https://github.com/adilmohak/django-lms.git
  • Create and activate a python virtual environment
pip install -r requirements.txt
  • Create .env file inside the root directory and include the following variables
# Database config
DB_NAME=[YOUR_DB_NAME]
DB_USER=[DB_ADMIN_NAME]
DB_PASSWORD=[DB_ADMIN_PASSWORD]
DB_HOST=localhost
DB_PORT=[YOUR_POSTGRES_PORT default is 5432]

# Email config
EMAIL_FROM_ADDRESS=Django LMS <[email protected]>
EMAIL_HOST_USER=[YOUR_EMAIL]
EMAIL_HOST_PASSWORD=[YOUR_EMAIL_PASSWORD]

# Other
DEBUG=True
SECRET_KEY=[YOUR_SECRET_KEY]
python manage.py migrate
python manage.py createsuperuser
python manage.py runserver

Make sure your Redis server is running

redis-server

Start the celery worker

celery -A config.celery worker -l INFO

Last but not least, go to this address http://127.0.0.1:8000

References

Connect with me

Help me improve the project and upgrade my trusty old laptop

adilmohak



Show your support by ⭐️ this project!

django-lms's People

Contributors

adilmohak avatar benaissazaki avatar ergoglobe avatar kaleblub avatar wajahatkanju avatar y938 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-lms's Issues

I can't run "python manage.py migrate", please give solution

PS C:\Users\ARSHAD\Documents\GitHub\django-lms> python manage.py migrate
Traceback (most recent call last):
File "C:\Users\ARSHAD\Documents\GitHub\django-lms\venv\Lib\site-packages\django\db\backends\base\base.py", line 244, in ensure_connection
self.connect()
File "C:\Users\ARSHAD\Documents\GitHub\django-lms\venv\Lib\site-packages\django\utils\asyncio.py", line 26, in inner
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ARSHAD\Documents\GitHub\django-lms\venv\Lib\site-packages\django\db\backends\base\base.py", line 225, in connect
self.connection = self.get_new_connection(conn_params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ARSHAD\Documents\GitHub\django-lms\venv\Lib\site-packages\django\utils\asyncio.py", line 26, in inner
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ARSHAD\Documents\GitHub\django-lms\venv\Lib\site-packages\django\db\backends\postgresql\base.py", line 203, in get_new_connection
connection = Database.connect(**conn_params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ARSHAD\Documents\GitHub\django-lms\venv\Lib\site-packages\psycopg2_init_.py", line 122, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
psycopg2.OperationalError: connection to server at "localhost" (::1), port 5432 failed: FATAL: role "[DB_ADMIN_NAME]" does not exist

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Users\ARSHAD\Documents\GitHub\django-lms\manage.py", line 21, in
main()
File "C:\Users\ARSHAD\Documents\GitHub\django-lms\manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "C:\Users\ARSHAD\Documents\GitHub\django-lms\venv\Lib\site-packages\django\core\management_init_.py", line 446, in execute_from_command_line
utility.execute()
File "C:\Users\ARSHAD\Documents\GitHub\django-lms\venv\Lib\site-packages\django\core\management_init_.py", line 440, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\ARSHAD\Documents\GitHub\django-lms\venv\Lib\site-packages\django\core\management\base.py", line 414, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\ARSHAD\Documents\GitHub\django-lms\venv\Lib\site-packages\django\core\management\base.py", line 460, in execute
output = self.handle(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ARSHAD\Documents\GitHub\django-lms\venv\Lib\site-packages\django\core\management\base.py", line 98, in wrapped
res = handle_func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ARSHAD\Documents\GitHub\django-lms\venv\Lib\site-packages\django\core\management\commands\migrate.py", line 91, in handle
self.check(databases=[database])
File "C:\Users\ARSHAD\Documents\GitHub\django-lms\venv\Lib\site-packages\django\core\management\base.py", line 487, in check
all_issues = checks.run_checks(
^^^^^^^^^^^^^^^^^^
File "C:\Users\ARSHAD\Documents\GitHub\django-lms\venv\Lib\site-packages\django\core\checks\registry.py", line 88, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ARSHAD\Documents\GitHub\django-lms\venv\Lib\site-packages\django\core\checks\model_checks.py", line 36, in check_all_models
errors.extend(model.check(**kwargs))
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ARSHAD\Documents\GitHub\django-lms\venv\Lib\site-packages\django\db\models\base.py", line 1461, in check
*cls._check_indexes(databases),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ARSHAD\Documents\GitHub\django-lms\venv\Lib\site-packages\django\db\models\base.py", line 1864, in _check_indexes
connection.features.supports_covering_indexes
File "C:\Users\ARSHAD\Documents\GitHub\django-lms\venv\Lib\site-packages\django\utils\functional.py", line 49, in get
res = instance.dict[self.name] = self.func(instance)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\ARSHAD\Documents\GitHub\django-lms\venv\Lib\site-packages\django\db\backends\postgresql\features.py", line 84, in is_postgresql_11
return self.connection.pg_version >= 110000
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ARSHAD\Documents\GitHub\django-lms\venv\Lib\site-packages\django\utils\functional.py", line 49, in get
res = instance.dict[self.name] = self.func(instance)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\ARSHAD\Documents\GitHub\django-lms\venv\Lib\site-packages\django\db\backends\postgresql\base.py", line 354, in pg_version
with self.temporary_connection():
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2288.0_x64__qbz5n2kfra8p0\Lib\contextlib.py", line 137, in enter
return next(self.gen)
^^^^^^^^^^^^^^
File "C:\Users\ARSHAD\Documents\GitHub\django-lms\venv\Lib\site-packages\django\db\backends\base\base.py", line 639, in temporary_connection
with self.cursor() as cursor:
^^^^^^^^^^^^^
File "C:\Users\ARSHAD\Documents\GitHub\django-lms\venv\Lib\site-packages\django\utils\asyncio.py", line 26, in inner
return func(*args, kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ARSHAD\Documents\GitHub\django-lms\venv\Lib\site-packages\django\db\backends\base\base.py", line 284, in cursor
return self._cursor()
^^^^^^^^^^^^^^
File "C:\Users\ARSHAD\Documents\GitHub\django-lms\venv\Lib\site-packages\django\db\backends\base\base.py", line 260, in cursor
self.ensure_connection()
File "C:\Users\ARSHAD\Documents\GitHub\django-lms\venv\Lib\site-packages\django\utils\asyncio.py", line 26, in inner
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ARSHAD\Documents\GitHub\django-lms\venv\Lib\site-packages\django\db\backends\base\base.py", line 243, in ensure_connection
with self.wrap_database_errors:
File "C:\Users\ARSHAD\Documents\GitHub\django-lms\venv\Lib\site-packages\django\db\utils.py", line 91, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File "C:\Users\ARSHAD\Documents\GitHub\django-lms\venv\Lib\site-packages\django\db\backends\base\base.py", line 244, in ensure_connection
self.connect()
File "C:\Users\ARSHAD\Documents\GitHub\django-lms\venv\Lib\site-packages\django\utils\asyncio.py", line 26, in inner
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ARSHAD\Documents\GitHub\django-lms\venv\Lib\site-packages\django\db\backends\base\base.py", line 225, in connect
self.connection = self.get_new_connection(conn_params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ARSHAD\Documents\GitHub\django-lms\venv\Lib\site-packages\django\utils\asyncio.py", line 26, in inner
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ARSHAD\Documents\GitHub\django-lms\venv\Lib\site-packages\django\db\backends\postgresql\base.py", line 203, in get_new_connection
connection = Database.connect(**conn_params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ARSHAD\Documents\GitHub\django-lms\venv\Lib\site-packages\psycopg2_init
.py", line 122, in connect
conn = _connect(dsn, connection_factory=connection_factory, kwasync)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
django.db.utils.OperationalError: connection to server at "localhost" (::1), port 5432 failed: FATAL: role "[DB_ADMIN_NAME]
" does not exist

### Source code:

CODE_OF_CONDUCT.md
CONTRIBUTING.md
README.md
requirements.txt
TODO.md

Spelling fix in course/models.py

Hello. In course/models.py, on lines 23 and 28, there is a typo in reference to bachelor's degrees. I was wondering if I could submit a pull request to fix it. Thank you for considering.

Test Coverage Improvement in Django LMS Project

Problem Description

The Django LMS project currently lacks a comprehensive testing suite, which poses a significant challenge for maintaining code quality, identifying potential bugs, and ensuring the reliability of the system. As part of the testing improvement initiative, it's important to address the absence of tests and work towards implementing a robust testing framework.

Current Testing Situation

Upon running the test suite using the Django management command python manage.py test, the output indicates a lack of tests in the project:

Found 0 test(s).
System check identified no issues (0 silenced).

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK

This output suggests that no tests are currently defined in the project, highlighting the need for immediate attention to improve the test coverage.

Suggested Changes

The following areas are recommended for testing to ensure better code quality and stability:

  • Unit Tests: Develop unit tests for individual functions, methods, and classes within the project's codebase. This will help identify and address issues at a granular level.

  • Integration Tests: Create integration tests to evaluate the interaction between different components and ensure that they work seamlessly together.

  • Functional Tests: Implement functional tests to validate that the LMS features are working as expected from an end-user perspective. This includes scenarios like user authentication, course enrollment, content delivery, etc.

  • Edge Cases: Test edge cases and boundary conditions to identify potential vulnerabilities or unexpected behavior in the system.

Benefits of Testing

  • Bug Identification: Testing helps identify and rectify bugs before they reach the production environment, improving the overall reliability of the system.

  • Code Quality: A comprehensive test suite contributes to better code quality by enforcing adherence to specifications and preventing regressions.

  • Maintainability: Tests make it easier to maintain and extend the project by providing a safety net against unintended changes.

How to Contribute

Contributors are encouraged to take on the task of writing tests for specific modules or functionalities. This involves creating test cases, ensuring adequate coverage, and validating that the tests pass successfully.

Expected Outcome

By improving the test coverage, we aim to enhance the overall quality of the Django LMS project, making it more robust, maintainable, and reliable.

Feel free to discuss, provide feedback, or volunteer to contribute to testing efforts.

Project Sustainability

You would need more maintainers for this to work. It looks nice but lacks enough maintainers to ensure the long term relevance and updatedness of the project. How do you intend to tackle this? You interested in having developers on board with you?

help asap not working

PS C:\Users\LENOVO Z40\django-lms> python manage.py makemigrations
Traceback (most recent call last):
File "C:\Users\LENOVO Z40\django-lms\manage.py", line 21, in
main()
File "C:\Users\LENOVO Z40\django-lms\manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "C:\Users\LENOVO Z40\AppData\Local\Programs\Python\Python311\Lib\site-packages\django\core\management_init_.py", line 446, in execute_from_command_line
utility.execute()
File "C:\Users\LENOVO Z40\AppData\Local\Programs\Python\Python311\Lib\site-packages\django\core\management_init_.py", line 386, in execute
settings.INSTALLED_APPS
File "C:\Users\LENOVO Z40\AppData\Local\Programs\Python\Python311\Lib\site-packages\django\conf_init_.py", line 87, in getattr
self.setup(name)
File "C:\Users\LENOVO Z40\AppData\Local\Programs\Python\Python311\Lib\site-packages\django\conf_init
.py", line 74, in setup
self.wrapped = Settings(settings_module)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\LENOVO Z40\AppData\Local\Programs\Python\Python311\Lib\site-packages\django\conf_init
.py", line 183, in init
mod = importlib.import_module(self.SETTINGS_MODULE)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\LENOVO Z40\AppData\Local\Programs\Python\Python311\Lib\importlib_init
.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1204, in _gcd_import
File "", line 1176, in _find_and_load
File "", line 1147, in _find_and_load_unlocked
File "", line 690, in _load_unlocked
File "", line 940, in exec_module
File "", line 241, in _call_with_frames_removed
File "C:\Users\LENOVO Z40\django-lms\config\settings.py", line 125, in
"NAME": config("DB_NAME"),
^^^^^^^^^^^^^^^^^
File "C:\Users\LENOVO Z40\AppData\Local\Programs\Python\Python311\Lib\site-packages\decouple.py", line 248, in call
return self.config(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\LENOVO Z40\AppData\Local\Programs\Python\Python311\Lib\site-packages\decouple.py", line 107, in call
return self.get(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\LENOVO Z40\AppData\Local\Programs\Python\Python311\Lib\site-packages\decouple.py", line 92, in get
raise UndefinedValueError('{} not found. Declare it as envvar or define a default value.'.format(option))
decouple.UndefinedValueError: DB_NAME not found. Declare it as envvar or define a default value.. i put in .env is DB_NAME=django_sms_data
DB_USER=postgres
DB_PASSWORD=testing321
DB_HOST=localhost
DB_PORT=5432 like in your youu=tube video but it says that please help

Quiz Edit

Editing and deletion of quiz not displaying for lectures who created it

problem in quizzes on program and course

Describe the bug
A clear and concise description of what the bug is.
there is issue or problem in the quizzes on the program and courses tab, the main problem is that the student is not given the permission to give or to attempt the quizzes, its says 403 error , forbidden . you don't have the permission that is required for it.
and the lecturer is not able to generate or make quizzes but can attempt for the quizzes made by admin or superuser.

so i request you to please check for that issue
Capture
i have uploaded the image for that

SECRET_KEY is hardcoded in the config/settings.py file

Is your feature request related to a problem? Please describe.
The SECRET_KEY setting's value is hardcoded in the settings.py file which is a bad practice in Django as it could have many security implications.

Describe the solution you'd like
Make the SECRET_KEY an environment variable and decouple it from the code as it is already the case for DEBUG or DB_NAME.

Describe alternatives you've considered
/

Additional context
/

Student Add and Drop

I am using your project, but i realized the add and drop is not yet up and i dont really know the code base and Django. i wanted to ask if that will be ready any time soon? I wanted to build on it to present as a final year project.

Feature Request - Django Extension for Populating Dummy Data in LMS

Issue Description

Background:
Contributing to the Django LMS project can be challenging for newcomers, especially when setting up a development environment with realistic data for testing and development purposes. To facilitate a smoother onboarding process for contributors, it would be beneficial to have a Django extension feature that automates the population of the database with dummy data for teachers, students, lecturers, courses, books, etc.

Feature Proposal

Introduce a Django management command or an extension that enables developers to easily populate the database with realistic and customizable dummy data. This feature should cover various aspects of the LMS, such as users (teachers, students, lecturers), courses, books, and any other relevant entities.

Key Requirements

  1. Flexibility: The feature should allow contributors to specify the quantity and types of dummy data to be generated, ensuring that it aligns with the specific needs of their testing scenarios.

  2. Realistic Data: The generated dummy data should closely resemble real-world scenarios, providing a more accurate representation of how the LMS functions in different situations.

  3. Ease of Use: The extension or management command should be easy to use, with clear documentation on how contributors can utilize it to populate their database with dummy data.

  4. Customization: It should offer options for customizing the characteristics of the generated data, such as randomization, specific attributes, and relationships between entities.

Potential Implementation

One possible implementation could be creating a management command named populate_dummy_data that accepts arguments or options for specifying the quantity and types of data to generate. For example:

python manage.py populate_dummy_data --teachers 10 --students 50 --courses 20 --books 30

Expected Outcome

With this feature, new contributors can effortlessly set up a development environment with realistic data, enabling them to focus on actual code contributions and testing scenarios without the burden of manually creating dummy data.

This feature will not only enhance the onboarding experience for contributors but also foster a more efficient and collaborative development environment.

Feel free to discuss and provide feedback on this proposal.

module error

(venv) PS D:\project\django-lms-main> python manage.py makemigrations
app_config = AppConfig.create(entry)
^^^^^^^^^^^^^^^^^^^^^^^
File "D:\project\django-lms-main\venv\Lib\site-packages\django\apps\config.py", line 228, in create
import_module(entry)
File "C:\Users\snm20\AppData\Local\Programs\Python\Python311\Lib\importlib_init_.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1206, in _gcd_import
File "", line 1178, in _find_and_load
File "", line 1142, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'django_cleanup'

this error is showing

Add and drop course for student

please tell me how can I add the feature of add & drop course for student

what changes will i have to do to make it run this feature

and one more thing is that i want to the student list that is displayed on the admin account or superuser, should also be displayed on the lecturer account. i have tried to call it inside the lecturer account but it doesn't open. whenever i click on the student list on the lecturer account it redirect me to the home page instead of student_list

please tell me the structure or tell me where i m going wrong

thanks , waiting for your reply

PostgreSQL to MySQL change reflects these errors

After changing the database driver from postgresql_psycopg2 to mysqlclient driver and ran some migrations and saw this error messages:

WARNINGS:
?: (mysql.W002) MariaDB Strict Mode is not set for database connection 'default'
HINT: MariaDB's Strict Mode fixes many data integrity problems in MariaDB, such as data truncation upon insertion, by escalating warnings into errors. It is strongly recommended you activate it. See: https://docs.djangoproject.com/en/4.0/ref/databases/#mysql-sql-mode
Operations to perform:
Apply all migrations: accounts, admin, app, auth, contenttypes, course, payments, quiz, result, sessions
Running migrations:
Applying payments.0002_testclass_array...Traceback (most recent call last):
File "C:\Users\USER\Envs\sms\Lib\site-packages\django\db\backends\utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER\Envs\sms\Lib\site-packages\django\db\backends\mysql\base.py", line 75, in execute
return self.cursor.execute(query, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER\Envs\sms\Lib\site-packages\MySQLdb\cursors.py", line 179, in execute
res = self._query(mogrified_query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER\Envs\sms\Lib\site-packages\MySQLdb\cursors.py", line 330, in _query
db.query(q)
File "C:\Users\USER\Envs\sms\Lib\site-packages\MySQLdb\connections.py", line 255, in query
_mysql.connection.query(self, query)
MySQLdb.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near
'[200] DEFAULT () NULL' at line 1")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Users\USER\Desktop\Projects\sms\manage.py", line 23, in
main()
File "C:\Users\USER\Desktop\Projects\sms\manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "C:\Users\USER\Envs\sms\Lib\site-packages\django\core\management_init_.py", line 446, in execute_from_command_line
utility.execute()
File "C:\Users\USER\Envs\sms\Lib\site-packages\django\core\management_init_.py", line 440, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\USER\Envs\sms\Lib\site-packages\django\core\management\base.py", line 414, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\USER\Envs\sms\Lib\site-packages\django\core\management\base.py", line 460, in execute
output = self.handle(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER\Envs\sms\Lib\site-packages\django\core\management\base.py", line 98, in wrapped
res = handle_func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER\Envs\sms\Lib\site-packages\django\core\management\commands\migrate.py", line 290, in handle
post_migrate_state = executor.migrate(
^^^^^^^^^^^^^^^^^
File "C:\Users\USER\Envs\sms\Lib\site-packages\django\db\migrations\executor.py", line 131, in migrate
state = self._migrate_all_forwards(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER\Envs\sms\Lib\site-packages\django\db\migrations\executor.py", line 163, in _migrate_all_forwards
state = self.apply_migration(
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER\Envs\sms\Lib\site-packages\django\db\migrations\executor.py", line 248, in apply_migration
state = migration.apply(state, schema_editor)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER\Envs\sms\Lib\site-packages\django\db\migrations\migration.py",
line 131, in apply
operation.database_forwards(
File "C:\Users\USER\Envs\sms\Lib\site-packages\django\db\migrations\operations\fields.py", line 108, in database_forwards
schema_editor.add_field(
File "C:\Users\USER\Envs\sms\Lib\site-packages\django\db\backends\mysql\schema.py", line 105, in add_field
super().add_field(model, field)
File "C:\Users\USER\Envs\sms\Lib\site-packages\django\db\backends\base\schema.py",
line 641, in add_field
self.execute(sql, params)
File "C:\Users\USER\Envs\sms\Lib\site-packages\django\db\backends\base\schema.py",
line 192, in execute
cursor.execute(sql, params)
File "C:\Users\USER\Envs\sms\Lib\site-packages\django\db\backends\utils.py", line 103, in execute
return super().execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER\Envs\sms\Lib\site-packages\django\db\backends\utils.py", line 67, in execute
return self._execute_with_wrappers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER\Envs\sms\Lib\site-packages\django\db\backends\utils.py", line 80, in _execute_with_wrappers
return executor(sql, params, many, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER\Envs\sms\Lib\site-packages\django\db\backends\utils.py", line 84, in _execute
with self.db.wrap_database_errors:
File "C:\Users\USER\Envs\sms\Lib\site-packages\django\db\utils.py", line 91, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File "C:\Users\USER\Envs\sms\Lib\site-packages\django\db\backends\utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER\Envs\sms\Lib\site-packages\django\db\backends\mysql\base.py", line 75, in execute
return self.cursor.execute(query, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER\Envs\sms\Lib\site-packages\MySQLdb\cursors.py", line 179, in execute
res = self._query(mogrified_query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER\Envs\sms\Lib\site-packages\MySQLdb\cursors.py", line 330, in _query
db.query(q)
File "C:\Users\USER\Envs\sms\Lib\site-packages\MySQLdb\connections.py", line 255, in query
_mysql.connection.query(self, query)
django.db.utils.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '[200] DEFAULT () NULL' at line 1")

Please is it a must to use postgreSQL?

Using template to PDF converter to generate reports

One additional item we can include in our TODO list is using a package that converts HTML templates to PDF to generate reports instead of using Python code as in result/views.py.
One popular package that does this is xhtml2pdf

Lack of Error Handling in Project's Email SMTP Configuration

The current implementation of the email sending functionality in the Django project does not effectively handle errors related to SMTP configuration. Specifically, when an incorrect email SMTP server is entered, the system freezes without providing any error message. This behavior persists regardless of whether the SMTP password is correct or incorrect.

Steps to reproduce the behavior:

  1. Setup the Django project.
  2. Install project dependencies using pip install -r requirements.txt.
  3. Create a superuser using python manage.py createsuperuser.
  4. Trigger an action that sends an email, such as a staff user creating a new entry.
  5. Observe the system behavior and lack of error handling when SMTP configuration errors occur during email transmission.

Expected behavior
I expected the system to handle SMTP configuration errors during email transmission appropriately. Specifically, when encountering an incorrect SMTP configuration, I expected the system to provide informative error messages or notifications, allowing for easier diagnosis and troubleshooting of the issue. Additionally, I anticipated that the system would not freeze but gracefully handle such errors, ensuring the continued functionality of the application.

Error Handling Implementation

Introduce error handling mechanisms within the email sending functionality to appropriately capture and manage SMTP configuration errors.

Exception Handling

Implement exception handling routines to catch potential errors that may arise during the process of sending emails, such as smtplib.SMTPException or smtplib.SMTPAuthenticationError.

Logging
Incorporate logging features to record any encountered errors or exceptions during email transmission. This logging functionality will facilitate troubleshooting and debugging efforts.

User Feedback
Ensure that users receive informative feedback when SMTP configuration errors occur during email transmission. This feedback can be conveyed through user interface notifications or system-generated messages.

Testing
Conduct comprehensive testing of the email sending functionality across various scenarios, including instances where the SMTP configuration is incorrect. This testing will validate the robustness and reliability of the email transmission process.

error in faculty creation

A socket operation was attempted to an unreachable network...
Request Method: POST
Request URL: http://127.0.0.1:7000/accounts/student/add/
Django Version: 4.0.8
Exception Type: OSError
Exception Value:
[WinError 10051] A socket operation was attempted to an unreachable network
Exception Location: C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\Lib\socket.py, line 836, in create_connection

well i am getting this error when i am trying to create faculty and student credentials would you please help me out

i searched in google it saying that as a smtp error

Login form not working when new Student is added from admin panel

So here's the deal, whenever I add a new student from admin panel and fill their details, then when I use their username and password in the login section of the website, it displays "Invalid ID and password", can you please check this out and see if its a bug or if I'm doing anything wrong? Thanks!

Timed Questions and Quiz

It will be useful to have timed Quiz and Questions.

  1. While creating a quiz, user should be able to specify time limit to complete quiz and time limit per question.
  2. Time limit for each question.

Thanks and Regards

The 'Program' model is sometimes referred to as 'Department'

In accounts/models.py > Student model:

department = models.ForeignKey(Program, on_delete=models.CASCADE, null=True)

In the Students page :
image

In the Add Student page :
image

I do not know if it is intentional but it is confusing for users and developers.

If possible, I want to create a PR to fix it, should Program become Department or vice-versa?

Dashboard showing: AttributeError at /dashboard/

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'

Student Form adds New student but mark it as Lecturer in DB

Student Form
In the student section of the Django LMS whenever I try to add new students after creating it shows the student added successfully with pop but it does not display in the List of students because it marks it as lecturer using that student.

Steps to check
Steps to reproduce the behaviour:

  1. Go to the Student Section
  2. Click on Add a student
  3. Fill the details in the form
  4. it will show a green pop that the student added successfully

Expected behaviour
After that, the student is shown in the list below but instead, it appears in the lecturer list of the newly added student. But it should be displayed in the student list.

Screenshots

Screenshot 2024-02-06 155857
Screenshot 2024-02-06 155916

Desktop (please complete the following information):

  • Windows: Window 11
  • Browser: Chrome
  • Version: latest
  • Code Editor: VS Code

Additional context
I am issuing while solution above issue because I can't understand while file I have to fix this logic.

Lack of Logging Implementation

Description:
Our project currently lacks logging implementation, which poses significant challenges in identifying and troubleshooting errors when they occur. Without logs, it becomes challenging to diagnose issues , leading to increased downtime and degraded user experience.

Recommendation:
To address this issue effectively, we need to prioritize the implementation of logging functionality within our project. It's crucial to identify and prioritize the types of logs that are most critical for ensuring system reliability and performance.

Types of Logs:

  1. Error Logs (Critical): Implementing error logs is paramount as they provide essential information about exceptions, crashes, or failures in the system. This type of logging is crucial for diagnosing and resolving issues promptly.

  2. Event Logs (Critical): Event logs capture significant events and actions within the system, aiding in understanding system behavior and identifying potential issues.

  3. Audit Logs (Critical): Audit logs are essential for tracking user activities and system changes for security and compliance purposes, ensuring accountability and regulatory adherence.

  4. Access Logs (Critical): Access logs provide insights into who accessed the system, what actions they performed, and when they occurred, helping to monitor and secure system access.

  5. Security Logs (Critical): Security logs document security-related events and policy violations, enabling timely detection and response to potential security threats.

Additional Logs (Can be added later):

  1. Performance Logs: While performance logs are valuable for optimizing system efficiency and identifying bottlenecks, they can be added at a later stage once the core logging functionality is in place.

  2. Debug Logs: Debug logs containing detailed information about system state and execution flow are beneficial during development and testing phases but can be implemented once the primary logging infrastructure is established.

Action Items:

  • Prioritize the implementation of critical logs (Error, Event, Audit, Access, Security) to ensure immediate visibility into system operations and errors.
  • Define logging requirements and specifications to guide the development of logging functionality.
  • Allocate resources and assign responsibility for implementing logging features within the project.
  • Establish logging best practices and guidelines to ensure consistency and effectiveness across the project.

By addressing the lack of logging implementation and prioritizing critical log types, we can significantly improve our ability to diagnose and resolve issues, enhancing the overall reliability and performance of our project.

'EssayQuestion' object has no attribute 'get_choices'

Describe the bug
after taking essay quiz when i hit check button 'EssayQuestion' object has no attribute 'get_choices' error raise

To Reproduce
Steps to reproduce the behavior:

  1. sign in as a student
  2. go to my courses and choose course
  3. click take a quiz
  4. click start essay quiz(created by admin)
  5. after answering the question click check
  6. error('EssayQuestion' object has no attribute 'get_choices')

Expected behavior
check your answer and show your score

Desktop (please complete the following information):

  • OS: window
  • Browser : chrome

Capture

Additional context
Adding the following code in quiz/model/EssayQuestion remove the error. but i don't think it's the right way

def get_choices(self):
        # Returning an empty list to signify no choices for essay questions
        return []

pip install psycopg2

Collecting psycopg2
Downloading psycopg2-2.9.9.tar.gz (384 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 384.9/384.9 KB 552.9 kB/s eta 0:00:00
Preparing metadata (setup.py) ... done
Using legacy 'setup.py install' for psycopg2, since package 'wheel' is not installed.
Installing collected packages: psycopg2
Running setup.py install for psycopg2 ... error
error: subprocess-exited-with-error

Γ— Running setup.py install for psycopg2 did not run successfully.
β”‚ exit code: 1
╰─> [40 lines of output]
running install
/home/papi/Documents/Dev/django-lms/venv/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.10
creating build/lib.linux-x86_64-3.10/psycopg2
copying lib/pool.py -> build/lib.linux-x86_64-3.10/psycopg2
copying lib/_range.py -> build/lib.linux-x86_64-3.10/psycopg2
copying lib/_ipaddress.py -> build/lib.linux-x86_64-3.10/psycopg2
copying lib/extensions.py -> build/lib.linux-x86_64-3.10/psycopg2
copying lib/init.py -> build/lib.linux-x86_64-3.10/psycopg2
copying lib/tz.py -> build/lib.linux-x86_64-3.10/psycopg2
copying lib/errorcodes.py -> build/lib.linux-x86_64-3.10/psycopg2
copying lib/errors.py -> build/lib.linux-x86_64-3.10/psycopg2
copying lib/sql.py -> build/lib.linux-x86_64-3.10/psycopg2
copying lib/extras.py -> build/lib.linux-x86_64-3.10/psycopg2
copying lib/_json.py -> build/lib.linux-x86_64-3.10/psycopg2
running build_ext
building 'psycopg2._psycopg' extension
creating build/temp.linux-x86_64-3.10
creating build/temp.linux-x86_64-3.10/psycopg
x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPSYCOPG_VERSION=2.9.9 (dt dec pq3 ext lo64) -DPSYCOPG_DEBUG=1 -DPG_VERSION_NUM=140011 -DHAVE_LO64=1 -DPSYCOPG_DEBUG=1 -I/home/papi/Documents/Dev/django-lms/venv/include -I/usr/include/python3.10 -I. -I/usr/include/postgresql -I/usr/include/postgresql/14/server -I/usr/include/libxml2 -c psycopg/adapter_asis.c -o build/temp.linux-x86_64-3.10/psycopg/adapter_asis.o -Wdeclaration-after-statement
In file included from psycopg/adapter_asis.c:28:
./psycopg/psycopg.h:36:10: fatal error: libpq-fe.h: No such file or directory
36 | #include <libpq-fe.h>
| ^~~~~~~~~~~~
compilation terminated.

  It appears you are missing some prerequisite to build the package from source.
  
  You may install a binary package by installing 'psycopg2-binary' from PyPI.
  If you want to install psycopg2 from source, please install the packages
  required for the build and try again.
  
  For further information please check the 'doc/src/install.rst' file (also at
  <https://www.psycopg.org/docs/install.html>).
  
  error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

Γ— Encountered error while trying to install package.
╰─> psycopg2

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

Forbidden (403) CSRF verification failed. Request aborted.

FRESH INSTALL
added domain to allowed hosts
visit domain
try to login with created superuser username/pw

get this, and on pw reset as well. can't access the django admin screen on /admin either!!

Forbidden (403)
CSRF verification failed. Request aborted.

Help
Reason given for failure:

Origin checking failed - https://example.com does not match any trusted origins.

In general, this can occur when there is a genuine Cross Site Request Forgery, or when Django’s CSRF mechanism has not been used correctly. For POST forms, you need to ensure:

Your browser is accepting cookies.
The view function passes a request to the template’s render method.
In the template, there is a {% csrf_token %} template tag inside each POST form that targets an internal URL.
If you are not using CsrfViewMiddleware, then you must use csrf_protect on any views that use the csrf_token template tag, as well as those that accept the POST data.
The form has a valid CSRF token. After logging in in another browser tab or hitting the back button after a login, you may need to reload the page with the form, because the token is rotated after a login.
You’re seeing the help section of this page because you have DEBUG = True in your Django settings file. Change that to False, and only the initial error message will be displayed.

You can customize this page using the CSRF_FAILURE_VIEW setting.

thanks

Profile Page Not Working

The profile page is not working despite of logging. I have logged in with admin id and pw and the profile page is not at all working. It says page not found. Below I have attached some of the screenshots of it.

image

image

Please look to it if there is any typo in code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.