From 75a014e148d5d3054f49b11b419dcf6abcde003c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Denis=20Rodrigues?= <joao.denisr@gmail.com> Date: Fri, 11 Aug 2017 11:34:43 -0300 Subject: [PATCH] settings do postgres + model para guardar todos os dados --- src/adega/settings.py | 15 +++++++++++++-- src/degree/models.py | 13 +++++++++++++ src/student/models.py | 1 + 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/adega/settings.py b/src/adega/settings.py index c24ec33..a99567c 100644 --- a/src/adega/settings.py +++ b/src/adega/settings.py @@ -81,10 +81,21 @@ WSGI_APPLICATION = 'adega.wsgi.application' # Database # https://docs.djangoproject.com/en/1.11/ref/settings/#databases +#DATABASES = { +# 'default': { +# 'ENGINE': 'django.db.backends.sqlite3', +# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), +# } +#} + DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + 'ENGINE': 'django.db.backends.postgresql_psycopg2', + 'NAME': 'adega', + 'USER': 'adega', + 'PASSWORD': '123456', + 'HOST': 'localhost', + 'PORT': '', } } diff --git a/src/degree/models.py b/src/degree/models.py index 8f6c417..1c9ee16 100644 --- a/src/degree/models.py +++ b/src/degree/models.py @@ -26,6 +26,19 @@ class CourseCurriculum(models.Model): period = models.PositiveIntegerField(null = True) type_course = models.CharField(max_length = 255) +class HistoryData(models.Model): + degree = models.ForeignKey(Degree) + student = models.ForeignKey(Student) + year = models.PositiveIntegerField(null = True, blank = True) + semester = models.PositiveIntegerField(null = True, blank = True) + situation = models.CharField(max_length=255) + letter = models.CharField(max_length=2) + course_code = models.CharField(max_length=5) + credits = models.PositiveIntegerField() + course_type = models.CharField(max_length=255) + frequency = models.FloatField() + #course = models.ForeignKey(Course) + class CourseCurriculumMongo(Document): start_year = fields.IntField() diff --git a/src/student/models.py b/src/student/models.py index 77db826..68d3ea8 100644 --- a/src/student/models.py +++ b/src/student/models.py @@ -14,6 +14,7 @@ class Student(models.Model): evasion_semester = models.PositiveIntegerField(null = True, blank = True) current_curriculum = models.ForeignKey(Curriculum) admission = models.ForeignKey(Admission) + admission_form = models.CharField(max_length=255) klasses = models.ManyToManyField('klass.Klass', through = 'klass.StudentKlass') def get_time_in_degree(self): -- GitLab