diff --git a/Website/api/models.py b/Website/api/models.py index 1dfd59a..5659835 100644 --- a/Website/api/models.py +++ b/Website/api/models.py @@ -64,9 +64,6 @@ class Student(models.Model): classes=models.CharField(max_length=100, default="", blank=True) added_to=models.CharField(max_length=100, default="", blank=True) completed=models.TextField(default="", blank=True) - + def save(self, *args, **kwargs): return super(Student, self).save(*args, **kwargs) - - - diff --git a/Website/config/__init__.py b/Website/config/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/Website/skoolos/asgi.py b/Website/config/asgi.py similarity index 82% rename from Website/skoolos/asgi.py rename to Website/config/asgi.py index 9577b84..561756d 100644 --- a/Website/skoolos/asgi.py +++ b/Website/config/asgi.py @@ -11,6 +11,6 @@ import os from django.core.asgi import get_asgi_application -os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'skoolos.settings') +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings') application = get_asgi_application() diff --git a/Website/skoolos/settings.py b/Website/config/settings.py similarity index 96% rename from Website/skoolos/settings.py rename to Website/config/settings.py index 4912bfc..b636949 100644 --- a/Website/skoolos/settings.py +++ b/Website/config/settings.py @@ -31,6 +31,7 @@ ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ + 'skoolos.apps.SkoolosConfig', 'users.apps.UsersConfig', 'django.contrib.admin', 'django.contrib.auth', @@ -64,7 +65,7 @@ MIDDLEWARE = [ 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] -ROOT_URLCONF = 'skoolos.urls' +ROOT_URLCONF = 'config.urls' TEMPLATES = [ { @@ -82,7 +83,7 @@ TEMPLATES = [ }, ] -WSGI_APPLICATION = 'skoolos.wsgi.application' +WSGI_APPLICATION = 'config.wsgi.application' # Database @@ -137,3 +138,5 @@ STATIC_URL = '/static/' CRISPY_TEMPLATE_PACK = 'bootstrap4' LOGIN_REDIRECT_URL = '/' + +LOGIN_URL = '/login' diff --git a/Website/config/urls.py b/Website/config/urls.py new file mode 100644 index 0000000..420beb6 --- /dev/null +++ b/Website/config/urls.py @@ -0,0 +1,31 @@ +from django.urls import path +from rest_framework import routers +from api import views as api_views +from django.contrib import admin +from django.conf.urls import include +from django.contrib.auth import views as auth_views + +router = routers.DefaultRouter() +router.register(r'students', api_views.StudentViewSet) +router.register(r'teachers', api_views.TeacherViewSet) +router.register(r'assignments', api_views.AssignmentViewSet) +router.register(r'classes', api_views.ClassesViewSet) +# router.register(r'files', api_views.DefFilesViewSet) +router.register(r'users', api_views.UserViewSet) + +from users import views as user_views +from users.forms import LoginForm + +# Wire up our API using automatic URL routing. +# Additionally, we include login URLs for the browsable API. +urlpatterns = [ + path('', include('skoolos.urls')), + path('api/', include(router.urls)), + path('api-auth/', include('rest_framework.urls')), + path('admin/', admin.site.urls), + path('login/', auth_views.LoginView.as_view(template_name='users/login.html', authentication_form=LoginForm), name='login'), + path('logout/', user_views.logout, name='logout'), + path('register/', user_views.register, name='register'), + path('create_account/', user_views.create_account, name='create_account'), + path('callback/', user_views.callback, name='callback'), +] diff --git a/Website/skoolos/wsgi.py b/Website/config/wsgi.py similarity index 82% rename from Website/skoolos/wsgi.py rename to Website/config/wsgi.py index f17107f..6b29610 100644 --- a/Website/skoolos/wsgi.py +++ b/Website/config/wsgi.py @@ -11,6 +11,6 @@ import os from django.core.wsgi import get_wsgi_application -os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'skoolos.settings') +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings') application = get_wsgi_application() diff --git a/Website/manage.py b/Website/manage.py index f17dda4..58c5f10 100755 --- a/Website/manage.py +++ b/Website/manage.py @@ -5,7 +5,7 @@ import sys def main(): - os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'skoolos.settings') + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings') try: from django.core.management import execute_from_command_line except ImportError as exc: diff --git a/Website/skoolos/admin.py b/Website/skoolos/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/Website/skoolos/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/Website/skoolos/apps.py b/Website/skoolos/apps.py new file mode 100644 index 0000000..6d65d67 --- /dev/null +++ b/Website/skoolos/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class SkoolosConfig(AppConfig): + name = 'skoolos' diff --git a/Website/skoolos/migrations/__init__.py b/Website/skoolos/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/Website/skoolos/models.py b/Website/skoolos/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/Website/skoolos/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/Website/skoolos/static/skoolos/styles.css b/Website/skoolos/static/skoolos/styles.css new file mode 100644 index 0000000..e69de29 diff --git a/Website/skoolos/templates/skoolos/base.html b/Website/skoolos/templates/skoolos/base.html new file mode 100644 index 0000000..ac4bb53 --- /dev/null +++ b/Website/skoolos/templates/skoolos/base.html @@ -0,0 +1,26 @@ +{% load static %} + + + + +
+ + + + + + + + + +