Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
fc629ea
1st attempt at base.html
potetz Oct 16, 2019
cad76dc
Merge pull request #1 from compsat/base-html
potetz Oct 19, 2019
5b67700
mademodels
YaoMorgan Nov 15, 2019
c7019ae
Update README to include Postgres
daniddelrio Nov 27, 2019
3a65e65
Migrate settings to Postgres
daniddelrio Nov 27, 2019
feee8b8
Add example env file
daniddelrio Nov 27, 2019
54213fb
Add old ERD
daniddelrio Nov 27, 2019
57a4851
Merge pull request #5 from compsat/refactor/migrate-postgres
daniddelrio Nov 27, 2019
a0303b3
Create .gitkeep
potetz Dec 26, 2019
d43e97e
login screen
potetz Dec 26, 2019
f962c35
login screen
potetz Dec 26, 2019
e03fe69
Set up static and CSS links
daniddelrio Dec 28, 2019
d932b96
fixed
potetz Dec 30, 2019
7a448e3
fixed
potetz Dec 30, 2019
e361da1
fixed
potetz Dec 30, 2019
c58d8ab
removed
potetz Dec 30, 2019
8c2bcc3
fixed
potetz Dec 30, 2019
0ea2145
fixed font
potetz Dec 30, 2019
8a4d31b
import from google fonts
potetz Dec 30, 2019
17ed961
fixed font
potetz Dec 30, 2019
f5f3a4b
Delete views.py
potetz Dec 30, 2019
8492f96
Merge pull request #8 from compsat/screens-k
potetz Jan 3, 2020
440bb0d
updated views and urls
potetz Jan 7, 2020
b490e75
updated the css for login and student list
potetz Jan 7, 2020
217c1da
finished the student list view
potetz Jan 7, 2020
a12fb3d
edited student list table
potetz Jan 25, 2020
bd1460c
fixed units and colors
potetz Jan 25, 2020
5a81f86
updated the table's css
potetz Feb 2, 2020
5a52f05
changed the width of the Actions column
potetz Feb 2, 2020
b816f45
Remove left margin CSS
daniddelrio Feb 6, 2020
902284f
Merge pull request #9 from compsat/screens-k
potetz Feb 6, 2020
0be1a16
First pull request changes from models
YaoMorgan Mar 1, 2020
f2de4ba
Merge branch 'develop' into mademodels
daniddelrio Mar 1, 2020
bdabd0f
Ignore migrations
daniddelrio Mar 1, 2020
52e94b3
Fix models
daniddelrio Mar 1, 2020
0e1e062
Removed blank and null in schoolyear
daniddelrio Mar 1, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ __pycache__/
# C extensions
*.so

# Ignore migrations
migrations

# Distribution / packaging
.Python
build/
Expand Down
31 changes: 24 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,23 @@ pip install [package_name]
```
If you find an external Python library which you think you can use for this project, you can install it in your virtualenv using this command. Don't forget to add the library and the version you installed to the requirements.txt so that other collaborators can also install the dependency in their virtualenvs.

### Postgres

Make sure that you've already installed Postgres on your computer. The Postgres details (username, password, database name, etc.) is found in the .env file, so your Postgres configuration MUST match the ones found in the .env. That means that the username, password and database name you create must be the same as the ones in the .env file. To configure your Postgres, follow the instructions in this [website](https://www.a2hosting.com/kb/developer-corner/postgresql/managing-postgresql-databases-and-users-from-the-command-line). Here's a summary of the steps:

Creating a Postgres user
1. `createuser --interactive --pwprompt` - creates a user with prompt
2. At the "Enter name of role to add:" prompt, type the user's name.
3. At the "Enter password for new role:" prompt, type a password for the user.
4. At the "Enter it again:" prompt, retype the password.
5. At the "Shall the new role be a superuser?" prompt, type y to grant superuser access.
6. At the "Shall the new role be allowed to create databases?" prompt, type y to grant database creation access.
7. At the "Shall the new role be allowed to create more new roles?" prompt, type y to grant role creation access.

Creating a Postgres database
1. `createdb -O [USER_NAME] [DB_NAME]` - creates a database. Make sure to replace the `[USER_NAME]` and `[DB_NAME]` with your username and database name, respectively.
2. Run `psql -U [USER_NAME] [DB_NAME]` to run your Postgres shell as the user you created.
3. `GRANT ALL ON DATABASE [DB_NAME] TO [USER_NAME];` - makes sure that your user has permissions to do any action to the database.

### Github Workflow
[Very helpful interactive tutorial on the Git workflow](https://learngitbranching.js.org/)
Expand Down Expand Up @@ -157,21 +174,21 @@ v.[field_name]_set.create(parameters…)
```
- creates objects and adds to the related set

### MySQL
### PostgreSQL
```
mysql -u root -p
psql -U [USER_NAME] [DB_NAME]
```
- opens shell of MySQL
- logs in your postgres user and in your database

#### In the MySQL shell:
#### In the PostgreSQL shell:
```
DROP DATABASE tanong_db;
```
- deletes the database named tanong_database
- deletes the database named tanong_db

```
CREATE DATABASE tanong_db;
```
- creates database named tanong_database
- creates database named tanong_db

**Note that the username and password of your MySQL configuration, as well as the name of the database you made, must match the ones in the .env file.**
**Note that the username and password of your PostgreSQL configuration, as well as the name of the database you made, must match the ones in the .env file.**
51 changes: 51 additions & 0 deletions database/models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,54 @@
from django.db import models
from django.contrib.auth import get_user_model

User = get_user_model()

# Create your models here.
class Request(models.Model):
user_access_ID= models.CharField(max_length=255)
request_time = models.DateTimeField(max_length=100,auto_now_add=True)

class Adviser(models.Model):
first_name = models.CharField(max_length=255)
middle_name = models.CharField(max_length=255)
last_name = models.CharField(max_length=255)
user = models.OneToOneField(User, on_delete=models.CASCADE)

class SchoolYear(models.Model):
years = models.CharField(max_length=5)

class Section(models.Model):
year_level = models.IntegerField()
name = models.CharField(max_length=255)
Adviser = models.ManyToManyField(Adviser)
schoolyear = models.ForeignKey(SchoolYear, on_delete=models.CASCADE)

class Student(models.Model):
first_name = models.CharField(max_length=255)
middle_name = models.CharField(max_length=255)
last_name = models.CharField(max_length=255)
birthdate = models.DateField()
sex_choices =[('MALE','male'),('FEMALE','female')]
sex = models.CharField(max_length=10, choices=sex_choices,default='MALE')
LRN = models.IntegerField(blank=True, null=True)

class Enrollment(models.Model):
quarter = models.IntegerField()
school_days = models.IntegerField()
days_absent = models.IntegerField()
student_id = models.ForeignKey(Student, on_delete=models.CASCADE)
section_id = models.ForeignKey(Section, on_delete=models.CASCADE)

class Subject(models.Model):
name = models.CharField(max_length=255)
subject_type = models.CharField(max_length=255)

class Grade(models.Model):
student_id = models.ForeignKey(Student, on_delete=models.CASCADE)
subject_id = models.ForeignKey(Subject, on_delete=models.CASCADE)
numerical_grade = models.IntegerField()
remark = models.CharField(max_length=100, blank='true',null='true')

class CoreValues(models.Model):
behavior_statement = models.CharField(max_length=100)
mark = models.CharField(max_length=50)
185 changes: 185 additions & 0 deletions database/static/database/css/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
/* CSS FOR THE LOGIN SCREEN */
/* for vertically aligning everything in innerdiv */
.divmain{
display: table;
position: absolute;
top: 0;left: 0;
height: 100%;
width: 100%;
}
.innerdiv{
display: table-cell;
vertical-align: middle;
}
.centerRoboto{
text-align: center;
font-family: 'Roboto', sans-serif;
}
.logininputdiv{
width: 16.6rem;
margin: auto;
}
.loginform{
padding-top: 1.6rem;
text-align: left;
font-size: 1rem;
}
.robotoFont{
font-family: 'Roboto', sans-serif;
}
.loginInput{
float: right;
width: 12.5em;
}
.topMargin10{
margin-top: 0.7rem;
}
.buttonDiv{
margin-top: 2.5em;
text-align:center;
}
.buttonStyle{
min-width:3.2em;
min-height:1.rem;
background-color: #E3E3E3;;
width:7.5em;
font-family: 'Roboto', sans-serif;
}
.leftMargin15{
margin-left: 0.9rem;
}
.leftMargin10{
margin-left: 0.6rem;
}

/* overwrite Bootstrap's striped table colors */
.table-striped>tbody>tr:nth-child(even)>td,
.table-striped>tbody>tr:nth-child(even)>th {
background-color:#6EA37D;
}.table-striped>tbody>tr:nth-child(odd)>td,
.table-striped>tbody>tr:nth-child(odd)>th {
background-color:#F2F2F2;
}

/* overwrite color of borders for the table */
.table-bordered > tbody > tr > td, .table-bordered > tbody > tr > th,
.table-bordered > tfoot > tr > td, .table-bordered > tfoot > tr > th,
.table-bordered > thead > tr > td, .table-bordered > thead > tr > th {
border: 1px solid rgba(201, 200, 200, 0.5);
}

.navstyle{
background-color:#3DBF61;
height:4rem;
margin-bottom: 0.9rem;
}
.navbrand{
color:black;
margin-left: 0.9rem;
}
.navbuttons{
text-align:right;
float: right;
margin-right: 0.9rem;
}
.headerbuttons{
background-color:#E3E3E3;
width:9.4em;
}
.screenhead{
margin-left: 2.2rem;
width: 25rem;
margin-bottom: 1.25rem;
}
.filtersdiv{
margin-top: 0.63rem;
text-align: center;
width: 64.38rem;
margin-left: auto;
margin-right: auto;
}
.filterlabel{
margin-right: 0.9em;
float: left;
margin-top: 0.13em;
}
.selectstyle{
background-color: #E5E5E5;
color:#494949;
float:left;
width: 11.06em;
height:2.2em;
border-color:#E5E5E5;
}
.leftMargin20{
margin-left: 1.25rem;
}
.filterbuttons{
background-color: #E3E3E3;
margin-left: 1.43em;
font-size: 0.875rem;
float: left;
}
.alignitems{
align-items:center;
}
.inline{
margin-top: 1.25em;
display: inline-block;
}
.searchlabels{
float: left;
margin-top:0.188em
}
.searchinputs{
width: 12.5em;
margin-left: 0.9em;
float: left;
height:2.2em;
background-color: #E5E5E5;
}
.hrstyle{
margin-top: 0.9rem;
width:80.125rem;
}
.tablestyle{
margin: auto;
margin-top: 1.5625rem;
width: 95%;
margin-bottom: 1.5625rem;
border-style: hidden;
}
.thstyle{
text-align: center;
color:white;
font-family: 'Roboto', sans-serif;
font-weight: normal;
}
.width80{
width: 4em;
}
.width140{
width: 8.75em;
}
.width130{
width: 8.125em;
}
.width250{
width: 15em;
}
.width120{
width: 5em;
}
.width160{
width: 10em;
}
.table-striped>tbody>tr:nth-child(even)>td>div>.tablebuttons{
background-color:#F2F2F2;
}.table-striped>tbody>tr:nth-child(odd)>td>div>.tablebuttons{
background-color:rgb(211, 211, 211);
}
.tablebuttons{
/* background-color: #E7E7E7; */
font-size: 0.875em;
min-width: 5em;
}
20 changes: 20 additions & 0 deletions database/templates/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{% load static %}

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>{% block title %}{% endblock %}</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/Sortable/1.10.1/Sortable.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Roboto&display=swap" rel="stylesheet">
<link rel="stylesheet" href="{% static 'database/css/main.css' %}">

</head>
<body>
{% block body %}
{% endblock %}
</body>
</html>
40 changes: 40 additions & 0 deletions database/templates/database/login.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{% extends 'base.html' %}
{% block title %}Login Page{% endblock %}
{% block body %}
<div class="divmain">
<div class="innerdiv">
<h1 class="centerRoboto">Ta&#241;ong Public High School</h1>

<h3 class="centerRoboto">Student Records</h3>

<div class="logininputdiv">

<form class="loginform">

<label class="robotoFont">Username</label>

<input class="form-control-sm loginInput">

<div class="form-group topMargin10">

<label class="robotoFont">Password</label>

<input class="form-control-sm loginInput" type="Password">

</div>

<div class="buttonDiv">

<!-- no login function -->

<a href="" class="btn btn-default buttonStyle">Sign In</a>
<a href="" class="btn btn-default buttonStyle leftMargin15">Register</a>
</div>

</form>

</div>
</div>
</div>

{% endblock %}
Loading