Skip to content
Snippets Groups Projects
Commit 3d637604 authored by João Denis Rodrigues's avatar João Denis Rodrigues
Browse files

Adicionado o professor

parent 4c9d342d
No related branches found
No related tags found
No related merge requests found
...@@ -42,6 +42,7 @@ INSTALLED_APPS = [ ...@@ -42,6 +42,7 @@ INSTALLED_APPS = [
'degree.apps.DegreeConfig', 'degree.apps.DegreeConfig',
'klass.apps.KlassConfig', 'klass.apps.KlassConfig',
'student.apps.StudentConfig', 'student.apps.StudentConfig',
'teacher.apps.TeacherConfig',
] ]
MIDDLEWARE = [ MIDDLEWARE = [
......
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('admission', '0001_initial'),
('student', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='student',
name='admission',
field=models.ForeignKey(default=None, to='admission.Admission'),
preserve_default=False,
),
]
...@@ -2,7 +2,7 @@ from django.db import models ...@@ -2,7 +2,7 @@ from django.db import models
from django.core.validators import MinValueValidator from django.core.validators import MinValueValidator
from degree.models import Curriculum from degree.models import Curriculum
from admission.models import Admission from admission.models import Admission
from utils.data import difference_semesters from utils.data import difference_between_semesters
# Create your models here. # Create your models here.
class Student(models.Model): class Student(models.Model):
...@@ -26,5 +26,5 @@ class Student(models.Model): ...@@ -26,5 +26,5 @@ class Student(models.Model):
year_start = self.admission.year year_start = self.admission.year
semester_start = self.admission.semester semester_start = self.admission.semester
difference = difference_semester(year_start, semester_start, year_end, semester_end) difference = difference_between_semesters(year_start, semester_start, year_end, semester_end)
return difference return difference
from django.contrib import admin
# Register your models here.
from django.apps import AppConfig
class TeacherConfig(AppConfig):
name = 'teacher'
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-31 13:44
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('degree', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Teacher',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('coordinations', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='coordinators', to='degree.Degree')),
('degrees', models.ManyToManyField(related_name='teachers', to='degree.Degree')),
('user', models.OneToOneField(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
]
from __future__ import unicode_literals
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Teacher(models.Model):
user = models.OneToOneField(User, null=True)
degrees = models.ManyToManyField('degree.Degree', related_name="teachers")
coordinations = models.ForeignKey('degree.Degree', related_name="coordinators", null=True, blank=True)
from django.test import TestCase
# Create your tests here.
from django.shortcuts import render
# Create your views here.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment