Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add placement #3

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
50 changes: 50 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

# C extensions
*.so

# Distribution / packaging
bin/
build/
develop-eggs/
dist/
eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
.tox/
.coverage
.cache
nosetests.xml
coverage.xml

# Translations
*.mo

# Mr Developer
.mr.developer.cfg
.project
.pydevproject

# Rope
.ropeproject

# Django stuff:
*.log
*.pot
*.sqlite3
# Sphinx documentation
docs/_build/
Binary file not shown.
Binary file modified django_school/classroom/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified django_school/classroom/__pycache__/decorators.cpython-37.pyc
Binary file not shown.
Binary file not shown.
Binary file modified django_school/classroom/__pycache__/forms.cpython-37.pyc
Binary file not shown.
Binary file not shown.
Binary file modified django_school/classroom/__pycache__/models.cpython-37.pyc
Binary file not shown.
Binary file not shown.
Binary file modified django_school/classroom/__pycache__/urls.cpython-37.pyc
Binary file not shown.
4 changes: 3 additions & 1 deletion django_school/classroom/admin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.contrib import admin
from classroom.models import User, Subject, Quiz, Question, Answer, Student, TakenQuiz, StudentAnswer
from classroom.models import User, Subject, Quiz, Question, Answer, Student, TakenQuiz, StudentAnswer, Selected_lists, Placement

admin.site.register(User)
admin.site.register(Subject)
Expand All @@ -9,3 +9,5 @@
admin.site.register(Student)
admin.site.register(TakenQuiz)
admin.site.register(StudentAnswer)
admin.site.register(Placement)
admin.site.register(Selected_lists)
8 changes: 8 additions & 0 deletions django_school/classroom/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@


class TeacherSignUpForm(UserCreationForm):
first_name = forms.CharField(max_length=30, required=False)
last_name = forms.CharField(max_length=30, required=False)
email = forms.EmailField(max_length=254)
class Meta(UserCreationForm.Meta):
model = User
fields = ('email', 'username', 'first_name', 'last_name')

def save(self, commit=True):
user = super().save(commit=False)
Expand All @@ -20,6 +24,9 @@ def save(self, commit=True):


class StudentSignUpForm(UserCreationForm):
first_name = forms.CharField(max_length=30, required=False)
last_name = forms.CharField(max_length=30, required=False)
email = forms.EmailField(max_length=254)
interests = forms.ModelMultipleChoiceField(
queryset=Subject.objects.all(),
widget=forms.CheckboxSelectMultiple,
Expand All @@ -28,6 +35,7 @@ class StudentSignUpForm(UserCreationForm):

class Meta(UserCreationForm.Meta):
model = User
fields = ('email', 'username', 'first_name', 'last_name')

@transaction.atomic
def save(self):
Expand Down
144 changes: 0 additions & 144 deletions django_school/classroom/migrations/0001_initial.py

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
14 changes: 14 additions & 0 deletions django_school/classroom/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ class Quiz(models.Model):
def __str__(self):
return self.name

class Placement(models.Model):
owner = models.ForeignKey(User, on_delete=models.CASCADE, related_name='placements')
company_name = models.CharField(max_length=255)
package = models.FloatField()

def __str__(self):
return self.company_name

class Question(models.Model):
quiz = models.ForeignKey(Quiz, on_delete=models.CASCADE, related_name='questions')
Expand All @@ -38,7 +45,14 @@ class Question(models.Model):
def __str__(self):
return self.text

class Selected_lists(models.Model):
placement = models.ForeignKey(Placement, on_delete=models.CASCADE, related_name='selected_lists')
roll_no = models.CharField(max_length=10)
name = models.CharField(max_length=255)

def __str__(self):
return self.name

class Answer(models.Model):
question = models.ForeignKey(Question, on_delete=models.CASCADE, related_name='answers')
text = models.CharField('Answer', max_length=255)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{% extends 'base_teacher.html' %}
{% load static%}<!DOCTYPE html>


<body>

{% block content %}
<div class="row">
<div class="col-lg-6 grid-margin stretch-card">
<div class="card">
<div class="card-body">
<h4 class="card-title">Line chart</h4>
<canvas id="lineChart" style="height:250px"></canvas>
</div>
</div>
</div>
<div class="col-lg-6 grid-margin stretch-card">
<div class="card">
<div class="card-body">
<h4 class="card-title">Bar chart</h4>
<canvas id="barChart" style="height:230px"></canvas>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6 grid-margin stretch-card">
<div class="card">
<div class="card-body">
<h4 class="card-title">Area chart</h4>
<canvas id="areaChart" style="height:250px"></canvas>
</div>
</div>
</div>
<div class="col-lg-6 grid-margin stretch-card">
<div class="card">
<div class="card-body">
<h4 class="card-title">Doughnut chart</h4>
<canvas id="doughnutChart" style="height:250px"></canvas>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6 grid-margin stretch-card">
<div class="card">
<div class="card-body">
<h4 class="card-title">Pie chart</h4>
<canvas id="pieChart" style="height:250px"></canvas>
</div>
</div>
</div>
<div class="col-lg-6 grid-margin stretch-card">
<div class="card">
<div class="card-body">
<h4 class="card-title">Scatter chart</h4>
<canvas id="scatterChart" style="height:250px"></canvas>
</div>
</div>
</div>
</div>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% extends 'base_teacher.html' %}

{% block content %}
Hello, This is a dashboard.!!
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{% extends 'base_teacher.html' %}

{% load crispy_forms_tags %}

{% block content %}
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{% url 'teachers:placement_change_list' %}">My Placemments</a></li>
<li class="breadcrumb-item"><a href="{% url 'teachers:placement_change' placement.pk %}">{{ placement.company_name }}</a></li>
<li class="breadcrumb-item active" aria-current="page">Upload a list</li>
</ol>
</nav>
{% if messages %}
{% for messages in messages %}
<div>
<strong>{{message|safe}}</strong>
</div>
{% endfor %}
{% else %}
<h2 class="mb-3">Upload the selection list</h2>
<p class="lead">{{order}}</p>
<form method="post" enctype="multipart/form-data">
{% csrf_token %}
<label>Upload a file</label>
<input type="file" name = "file">
<button type="submit" class="btn btn-success">Upload</button>
<a href="{% url 'teachers:placement_change' placement.pk %}" class="btn btn-outline-secondary" role="button">Nevermind</a>
</form>
{% endif %}
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{% extends 'base_teacher.html' %}

{% load crispy_forms_tags %}

{% block content %}
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{% url 'teachers:placement_change_list' %}">My Placements</a></li>
<li class="breadcrumb-item active" aria-current="page">Add a new placement</li>
</ol>
</nav>
<h2 class="mb-3">Add a new placement</h2>
<div class="row">
<div class="col-md-6 col-sm-8 col-12">
<form method="post" novalidate>
{% csrf_token %}
{{ form|crispy }}
<button type="submit" class="btn btn-success">Save</button>
<a href="{% url 'teachers:placement_change_list' %}" class="btn btn-outline-secondary" role="button">Nevermind</a>
</form>
</div>
</div>
{% endblock %}
Loading