-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: add make teacher script * fix: added psychology faculty icon * fix: faculty image filter * chore: linting * feat: role user mixin * Calendar view improvements (#257) * chore: add make teacher script * fix: added psychology faculty icon --------- Co-authored-by: tyboro2002 <verslypetybo@hotmail.com> * chore: user permissions account for is_active * chore: added role management tests, extracted common logic in helpers * fix: student service parameter * chore: linting * chore: removed comment in seeder --------- Co-authored-by: tyboro2002 <verslypetybo@hotmail.com>
- Loading branch information
1 parent
448249a
commit 26e5e43
Showing
42 changed files
with
959 additions
and
946 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
.venv | ||
.idea | ||
staticfiles | ||
db.sqlite3 | ||
__pycache__ | ||
*.mo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from django.core.management.base import BaseCommand | ||
from api.models.student import Student | ||
from api.models.teacher import Teacher | ||
|
||
|
||
class Command(BaseCommand): | ||
|
||
help = 'make yourself teacher' | ||
|
||
def add_arguments(self, parser): | ||
parser.add_argument('username', type=str, help='The username of the student user to make teacher') | ||
|
||
def handle(self, *args, **options): | ||
username = options['username'] | ||
student = Student.objects.filter(username=username) | ||
|
||
if student.count() == 0: | ||
self.stdout.write(self.style.ERROR('User not found, first log in !')) | ||
return | ||
|
||
Teacher.create(student.get(), create_time=student.create_time) | ||
|
||
self.stdout.write(self.style.SUCCESS('Successfully made the user teacher!')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
backend/api/migrations/0012_errortemplate_alter_extrachecksresult_error_message_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Generated by Django 5.0.4 on 2024-04-09 10:47 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('api', '0011_revise_extra_checks'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='ErrorTemplate', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('message_key', models.CharField(max_length=256)), | ||
], | ||
), | ||
migrations.AlterField( | ||
model_name='extrachecksresult', | ||
name='error_message', | ||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='extra_checks_results', to='api.errortemplate'), | ||
), | ||
migrations.DeleteModel( | ||
name='ErrorTemplates', | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 5.0.4 on 2024-04-09 10:51 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('api', '0012_errortemplate_alter_extrachecksresult_error_message_and_more'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='student', | ||
name='is_active', | ||
field=models.BooleanField(default=True), | ||
), | ||
] |
30 changes: 30 additions & 0 deletions
30
.../migrations/0013_student_is_active_squashed_0014_assistant_is_active_teacher_is_active.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Generated by Django 5.0.4 on 2024-04-09 10:53 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
replaces = [('api', '0013_student_is_active'), ('api', '0014_assistant_is_active_teacher_is_active')] | ||
|
||
dependencies = [ | ||
('api', '0012_errortemplate_alter_extrachecksresult_error_message_and_more'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='student', | ||
name='is_active', | ||
field=models.BooleanField(default=True), | ||
), | ||
migrations.AddField( | ||
model_name='assistant', | ||
name='is_active', | ||
field=models.BooleanField(default=True), | ||
), | ||
migrations.AddField( | ||
model_name='teacher', | ||
name='is_active', | ||
field=models.BooleanField(default=True), | ||
), | ||
] |
23 changes: 23 additions & 0 deletions
23
backend/api/migrations/0014_assistant_is_active_teacher_is_active.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Generated by Django 5.0.4 on 2024-04-09 10:51 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('api', '0013_student_is_active'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='assistant', | ||
name='is_active', | ||
field=models.BooleanField(default=True), | ||
), | ||
migrations.AddField( | ||
model_name='teacher', | ||
name='is_active', | ||
field=models.BooleanField(default=True), | ||
), | ||
] |
Oops, something went wrong.