From fd5e20e1dd2efa40970c6f3a1b54066c7ece3772 Mon Sep 17 00:00:00 2001 From: shabirtech Date: Sat, 13 May 2023 15:33:23 +0500 Subject: [PATCH] added Cnic field in teacher model --- requirements.txt | 2 +- .../0002_alter_studentfee_valid_until.py | 19 ++++++++ teachers/admin.py | 3 +- ...acher_cnic_teachersalary_financesummary.py | 44 +++++++++++++++++++ teachers/models.py | 1 + 5 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 students/migrations/0002_alter_studentfee_valid_until.py create mode 100644 teachers/migrations/0002_teacher_cnic_teachersalary_financesummary.py diff --git a/requirements.txt b/requirements.txt index d7f0f0f3..de904476 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,7 +5,7 @@ django-debug-toolbar django-filter django-flat-responsive django-flat-theme -django +django==4.2.1 pillow pytz sqlparse diff --git a/students/migrations/0002_alter_studentfee_valid_until.py b/students/migrations/0002_alter_studentfee_valid_until.py new file mode 100644 index 00000000..986be257 --- /dev/null +++ b/students/migrations/0002_alter_studentfee_valid_until.py @@ -0,0 +1,19 @@ +# Generated by Django 4.2.1 on 2023-05-13 10:31 + +import datetime +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('students', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='studentfee', + name='valid_until', + field=models.DateField(default=datetime.date(2023, 6, 1), verbose_name='Valid Until'), + ), + ] diff --git a/teachers/admin.py b/teachers/admin.py index 0eb5b0e9..7ca2b0fe 100644 --- a/teachers/admin.py +++ b/teachers/admin.py @@ -5,7 +5,8 @@ from django.contrib.auth.admin import UserAdmin from django.contrib.auth.forms import UserCreationForm from django.contrib.auth.models import User -from django.utils.translation import ugettext_lazy as _ +# from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from django.db.models import Sum from django.db.models.functions import Trunc diff --git a/teachers/migrations/0002_teacher_cnic_teachersalary_financesummary.py b/teachers/migrations/0002_teacher_cnic_teachersalary_financesummary.py new file mode 100644 index 00000000..f5022397 --- /dev/null +++ b/teachers/migrations/0002_teacher_cnic_teachersalary_financesummary.py @@ -0,0 +1,44 @@ +# Generated by Django 4.2.1 on 2023-05-13 10:31 + +import datetime +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('teachers', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='teacher', + name='cnic', + field=models.CharField(default='added fields', max_length=13), + preserve_default=False, + ), + migrations.CreateModel( + name='TeacherSalary', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('valid_until', models.DateField(default=datetime.date(2023, 6, 1), verbose_name='Valid Until')), + ('total_amount', models.PositiveIntegerField(default=0)), + ('paid_on', models.DateTimeField(auto_now_add=True)), + ('teacher', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='teachers.teacher')), + ], + ), + migrations.CreateModel( + name='FinanceSummary', + fields=[ + ], + options={ + 'verbose_name': 'Finance Summary', + 'verbose_name_plural': 'Finance Summary', + 'proxy': True, + 'indexes': [], + 'constraints': [], + }, + bases=('teachers.teachersalary',), + ), + ] diff --git a/teachers/models.py b/teachers/models.py index 9a6459a2..e5165e67 100644 --- a/teachers/models.py +++ b/teachers/models.py @@ -17,6 +17,7 @@ class Teacher(models.Model): date_of_birth = models.DateField() social_security_number = models.CharField(max_length=30) phone_no = models.CharField(max_length=11, default="0000000") + cnic = models.CharField(max_length=13) address = models.CharField(max_length=150, default="Not Set") is_teaching = models.BooleanField(default=True) profile_image = models.ImageField(upload_to=user_directory_path, blank=True)