-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make root user and the test for the model students
- Loading branch information
1 parent
cb464f9
commit 42f2209
Showing
6 changed files
with
56 additions
and
48 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
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
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,34 @@ | ||
# Generated by Django 4.1.2 on 2023-08-25 17:28 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('backend', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Mainuser', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('fullname', models.CharField(max_length=100)), | ||
('username', models.CharField(max_length=200, unique=True)), | ||
('password', models.CharField(max_length=250)), | ||
('email', models.EmailField(max_length=254, unique=True)), | ||
('jnumber', models.IntegerField()), | ||
('role', models.CharField(max_length=100)), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name='Student', | ||
fields=[ | ||
('mainuser_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, to='backend.mainuser')), | ||
('student_id', models.AutoField(primary_key=True, serialize=False)), | ||
], | ||
bases=('backend.mainuser',), | ||
), | ||
] |
This file was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
|
@@ -42,10 +42,9 @@ def test_event_content(self): | |
self.assertEqual(str(category), 'django') | ||
|
||
def test_student(self): | ||
test_user = Student.objects.create(first_name='Robera',last_name='Melaek',email='[email protected]') | ||
test_user = Student.objects.create(fullname='Robera',username='Melaek',email='[email protected]',jnumber=1,role='teacher') | ||
username = Student.objects.get(id=1) | ||
assert(username.first_name,'Robera') | ||
|
||
self.assertEqual(f'{username.username}','Melaek') | ||
|
||
|
||
|
||
|