This repository has been archived by the owner on Apr 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
12 changed files
with
220 additions
and
3 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
Empty file.
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,3 @@ | ||
from django.contrib import admin | ||
|
||
# Register your models here. |
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,5 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class RiwConfig(AppConfig): | ||
name = 'riw' |
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,124 @@ | ||
from django.db import models | ||
|
||
class Course (models.Model): | ||
name = models.CharField (max_length=150) | ||
def __str__(self) : | ||
return self.name | ||
|
||
|
||
class Course_class (models.Model): | ||
# Foreign Keys | ||
course = models.ForeignKey('Course') | ||
instructor = models.ForeignKey('users.User') | ||
|
||
title = models.CharField(max_length=150) | ||
created_at = models.DateTimeField() | ||
started_at = models.DateTimeField(null=True, blank= True) | ||
finished_at = models.DateTimeField(null=True, blank= True) | ||
enrolling = models.BooleanField(default=False) | ||
max_students = models.IntegerField() | ||
|
||
class Meta: | ||
verbose_name_plural = "Course classes" | ||
|
||
class Module(models.Model): | ||
title = models.CharField(max_length=100) | ||
|
||
def __str__(self) : | ||
return self.title | ||
|
||
class Activity(models.Model): | ||
# Foreign Keys | ||
course = models.ForeignKey('Course') | ||
module = models.ForeignKey('Module') | ||
|
||
title = models.CharField(max_length=150) | ||
content = models.TextField() | ||
course_position = models.IntegerField() | ||
|
||
class Meta: | ||
verbose_name_plural = "Activities" | ||
|
||
def __str__(self) : | ||
return self.title | ||
|
||
class Exercise(models.Model): | ||
# Foreign Keys | ||
activity = models.ForeignKey('Activity') | ||
|
||
content = models.TextField() | ||
|
||
class Meta: | ||
verbose_name_plural = "Exercises" | ||
|
||
class Grammar(models.Model): | ||
# Foreign Keys | ||
module = models.ForeignKey('Module') | ||
|
||
content = models.TextField() | ||
|
||
class Meta: | ||
verbose_name_plural = "Grammars" | ||
|
||
class Strategy(models.Model): | ||
# Foreign Keys | ||
module = models.ForeignKey('Module') | ||
|
||
content = models.TextField() | ||
reading = models.BooleanField() | ||
|
||
class Meta: | ||
verbose_name_plural = "Strategies" | ||
|
||
class Functional_word(models.Model): | ||
# Foreign Keys | ||
module = models.ForeignKey('Module') | ||
|
||
word = models.CharField(max_length=50) | ||
meaning = models.CharField(max_length=100) | ||
|
||
class Meta: | ||
verbose_name_plural = "Functional Words" | ||
|
||
|
||
class Glossary(models.Model): | ||
# Foreign Keys | ||
module = models.ForeignKey('Module') | ||
|
||
word = models.CharField(max_length=50) | ||
translation = models.CharField(max_length=100) | ||
|
||
class Meta: | ||
verbose_name_plural = "Glossaries" | ||
|
||
|
||
class Activity_released(models.Model): | ||
# Foreign Keys | ||
course_class = models.ForeignKey('Course_class') | ||
activity = models.ForeignKey('activity') | ||
|
||
released = models.BooleanField() | ||
|
||
class Meta: | ||
verbose_name_plural = "Released Activities" | ||
|
||
class Student_progress(models.Model): | ||
# Foreign Keys | ||
student = models.ForeignKey('users.User') | ||
activity = models.ForeignKey('Activity') | ||
course_class = models.ForeignKey('Course_class') | ||
|
||
complete = models.BooleanField() | ||
|
||
class Meta: | ||
verbose_name_plural = "Students Progress" | ||
|
||
class Allowed_student(models.Model): | ||
# Foreign Keys | ||
student = models.ForeignKey('users.User') | ||
|
||
course_class = models.ForeignKey('Course_class') | ||
allowed = models.BooleanField() | ||
|
||
class Meta: | ||
verbose_name_plural = "Allowed Students" |
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,3 @@ | ||
from django.test import TestCase | ||
|
||
# Create your tests here. |
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,10 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
from django.conf import settings | ||
from django.conf.urls import include, url | ||
from . import views | ||
|
||
urlpatterns = [ | ||
url(r'^$', views.ClassListView.as_view(), name='list'), | ||
] |
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,12 @@ | ||
from django.shortcuts import render | ||
from django.views.generic import DetailView, ListView, RedirectView, UpdateView | ||
from django.contrib.auth.mixins import LoginRequiredMixin | ||
|
||
from .models import * | ||
|
||
# Create your views here. | ||
class ClassListView(ListView): | ||
model = Course | ||
# These next two lines tell the view to index lookups by username | ||
# slug_field = 'username' | ||
# slug_url_kwarg = 'username' |
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,35 @@ | ||
{% extends "base.html" %} | ||
{% load static %} | ||
|
||
{% block title %}User: {{ object.name }}{% endblock %} | ||
|
||
{% block content %} | ||
<div class="container"> | ||
|
||
<div class="row"> | ||
<div class="col-sm-12"> | ||
|
||
<h2>{{ object.name }}</h2> | ||
{% if object.name %} | ||
<p>{{ object.name }}</p> | ||
{% endif %} | ||
</div> | ||
</div> | ||
|
||
{% if object == request.user %} | ||
<!-- Action buttons --> | ||
<div class="row"> | ||
|
||
<div class="col-sm-12 "> | ||
<a class="btn btn-primary" href="{% url 'users:update' %}">My Info</a> | ||
<a class="btn btn-primary" href="{% url 'account_email' %}">E-Mail</a> | ||
<!-- Your Stuff: Custom user template urls --> | ||
</div> | ||
|
||
</div> | ||
<!-- End Action buttons --> | ||
{% endif %} | ||
|
||
|
||
</div> | ||
{% endblock content %} |
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,22 @@ | ||
{% extends "base.html" %} | ||
{% load static %}{% load i18n %} | ||
{% block title %}Course{% endblock %} | ||
|
||
{% block content %} | ||
|
||
<div class="container"> | ||
|
||
<h2>Courses</h2> | ||
|
||
<div class="list-group"> | ||
{% for course in course_list %} | ||
<a href="{% url 'users:detail' user.username %}" class="list-group-item"> | ||
<h4 class="list-group-item-heading">{{ course.name }}</h4> | ||
</a> | ||
{% endfor %} | ||
|
||
</div> | ||
|
||
</div> | ||
|
||
{% endblock content %} |
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 |
---|---|---|
|
@@ -33,4 +33,3 @@ <h2>{{ object.username }}</h2> | |
|
||
</div> | ||
{% endblock content %} | ||
|