From a4c55565ec4649746ed1e994e50fde329aa46c90 Mon Sep 17 00:00:00 2001 From: Joshua Rubingh Date: Wed, 13 May 2020 15:54:40 +0200 Subject: [PATCH] First version --- .gitignore | 7 + .../apps/RUG_template/__init__.py | 1 + .../apps/RUG_template/admin.py | 3 + .../apps/RUG_template/apps.py | 8 + .../apps/RUG_template/migrations/__init__.py | 0 .../apps/RUG_template/models.py | 3 + .../static/RUG_template/css/base.css | 24 + .../apps/RUG_template/templates/base.html | 608 ++++++++++++++++ .../apps/RUG_template/templates/index.html | 11 + .../apps/RUG_template/templates/menu.html | 13 + .../apps/RUG_template/templates/pager.html | 29 + .../templates/registration/login.html | 24 + .../registration/password_reset_complete.html | 12 + .../registration/password_reset_confirm.html | 25 + .../registration/password_reset_done.html | 13 + .../registration/password_reset_form.html | 24 + .../apps/RUG_template/templates/singup.html | 20 + .../apps/RUG_template/tests.py | 3 + .../apps/RUG_template/urls.py | 7 + .../apps/RUG_template/views.py | 7 + .../apps/employee/__init__.py | 1 + polyclinic_scheduling/apps/employee/admin.py | 20 + polyclinic_scheduling/apps/employee/apps.py | 8 + .../apps/employee/migrations/0001_initial.py | 34 + .../apps/employee/migrations/__init__.py | 0 polyclinic_scheduling/apps/employee/models.py | 20 + polyclinic_scheduling/apps/employee/tests.py | 3 + polyclinic_scheduling/apps/employee/views.py | 3 + .../apps/hospital/__init__.py | 1 + polyclinic_scheduling/apps/hospital/admin.py | 10 + polyclinic_scheduling/apps/hospital/apps.py | 8 + .../apps/hospital/migrations/0001_initial.py | 30 + .../apps/hospital/migrations/__init__.py | 0 polyclinic_scheduling/apps/hospital/models.py | 16 + polyclinic_scheduling/apps/hospital/tests.py | 3 + polyclinic_scheduling/apps/hospital/views.py | 3 + .../apps/polyclinic/__init__.py | 1 + .../apps/polyclinic/admin.py | 10 + polyclinic_scheduling/apps/polyclinic/apps.py | 8 + .../polyclinic/migrations/0001_initial.py | 30 + .../apps/polyclinic/migrations/__init__.py | 0 .../apps/polyclinic/models.py | 15 + .../apps/polyclinic/tests.py | 3 + .../apps/polyclinic/views.py | 3 + .../apps/schedule/__init__.py | 1 + polyclinic_scheduling/apps/schedule/admin.py | 15 + polyclinic_scheduling/apps/schedule/apps.py | 8 + polyclinic_scheduling/apps/schedule/forms.py | 9 + .../apps/schedule/migrations/0001_initial.py | 36 + .../apps/schedule/migrations/__init__.py | 0 polyclinic_scheduling/apps/schedule/models.py | 26 + .../templates/schedule/schedule_list.html | 37 + .../templates/schedule/schedule_new.html | 650 ++++++++++++++++++ polyclinic_scheduling/apps/schedule/tests.py | 3 + polyclinic_scheduling/apps/schedule/urls.py | 9 + polyclinic_scheduling/apps/schedule/views.py | 50 ++ polyclinic_scheduling/lib/models/base.py | 20 + .../locale/en/LC_MESSAGES/django.po | 318 +++++++++ .../locale/nl/LC_MESSAGES/django.po | 318 +++++++++ polyclinic_scheduling/manage.py | 21 + .../polyclinic_scheduling/.env.example | 38 + .../polyclinic_scheduling/__init__.py | 0 .../polyclinic_scheduling/asgi.py | 16 + .../polyclinic_scheduling/settings.py | 162 +++++ .../polyclinic_scheduling/urls.py | 34 + .../polyclinic_scheduling/wsgi.py | 16 + polyclinic_scheduling/templates/menu.html | 23 + polyclinic_scheduling/templates/singup.html | 13 + requirements.txt | 4 + 69 files changed, 2899 insertions(+) create mode 100644 .gitignore create mode 100644 polyclinic_scheduling/apps/RUG_template/__init__.py create mode 100644 polyclinic_scheduling/apps/RUG_template/admin.py create mode 100644 polyclinic_scheduling/apps/RUG_template/apps.py create mode 100644 polyclinic_scheduling/apps/RUG_template/migrations/__init__.py create mode 100644 polyclinic_scheduling/apps/RUG_template/models.py create mode 100644 polyclinic_scheduling/apps/RUG_template/static/RUG_template/css/base.css create mode 100644 polyclinic_scheduling/apps/RUG_template/templates/base.html create mode 100644 polyclinic_scheduling/apps/RUG_template/templates/index.html create mode 100644 polyclinic_scheduling/apps/RUG_template/templates/menu.html create mode 100644 polyclinic_scheduling/apps/RUG_template/templates/pager.html create mode 100644 polyclinic_scheduling/apps/RUG_template/templates/registration/login.html create mode 100644 polyclinic_scheduling/apps/RUG_template/templates/registration/password_reset_complete.html create mode 100644 polyclinic_scheduling/apps/RUG_template/templates/registration/password_reset_confirm.html create mode 100644 polyclinic_scheduling/apps/RUG_template/templates/registration/password_reset_done.html create mode 100644 polyclinic_scheduling/apps/RUG_template/templates/registration/password_reset_form.html create mode 100644 polyclinic_scheduling/apps/RUG_template/templates/singup.html create mode 100644 polyclinic_scheduling/apps/RUG_template/tests.py create mode 100644 polyclinic_scheduling/apps/RUG_template/urls.py create mode 100644 polyclinic_scheduling/apps/RUG_template/views.py create mode 100644 polyclinic_scheduling/apps/employee/__init__.py create mode 100644 polyclinic_scheduling/apps/employee/admin.py create mode 100644 polyclinic_scheduling/apps/employee/apps.py create mode 100644 polyclinic_scheduling/apps/employee/migrations/0001_initial.py create mode 100644 polyclinic_scheduling/apps/employee/migrations/__init__.py create mode 100644 polyclinic_scheduling/apps/employee/models.py create mode 100644 polyclinic_scheduling/apps/employee/tests.py create mode 100644 polyclinic_scheduling/apps/employee/views.py create mode 100644 polyclinic_scheduling/apps/hospital/__init__.py create mode 100644 polyclinic_scheduling/apps/hospital/admin.py create mode 100644 polyclinic_scheduling/apps/hospital/apps.py create mode 100644 polyclinic_scheduling/apps/hospital/migrations/0001_initial.py create mode 100644 polyclinic_scheduling/apps/hospital/migrations/__init__.py create mode 100644 polyclinic_scheduling/apps/hospital/models.py create mode 100644 polyclinic_scheduling/apps/hospital/tests.py create mode 100644 polyclinic_scheduling/apps/hospital/views.py create mode 100644 polyclinic_scheduling/apps/polyclinic/__init__.py create mode 100644 polyclinic_scheduling/apps/polyclinic/admin.py create mode 100644 polyclinic_scheduling/apps/polyclinic/apps.py create mode 100644 polyclinic_scheduling/apps/polyclinic/migrations/0001_initial.py create mode 100644 polyclinic_scheduling/apps/polyclinic/migrations/__init__.py create mode 100644 polyclinic_scheduling/apps/polyclinic/models.py create mode 100644 polyclinic_scheduling/apps/polyclinic/tests.py create mode 100644 polyclinic_scheduling/apps/polyclinic/views.py create mode 100644 polyclinic_scheduling/apps/schedule/__init__.py create mode 100644 polyclinic_scheduling/apps/schedule/admin.py create mode 100644 polyclinic_scheduling/apps/schedule/apps.py create mode 100644 polyclinic_scheduling/apps/schedule/forms.py create mode 100644 polyclinic_scheduling/apps/schedule/migrations/0001_initial.py create mode 100644 polyclinic_scheduling/apps/schedule/migrations/__init__.py create mode 100644 polyclinic_scheduling/apps/schedule/models.py create mode 100644 polyclinic_scheduling/apps/schedule/templates/schedule/schedule_list.html create mode 100644 polyclinic_scheduling/apps/schedule/templates/schedule/schedule_new.html create mode 100644 polyclinic_scheduling/apps/schedule/tests.py create mode 100644 polyclinic_scheduling/apps/schedule/urls.py create mode 100644 polyclinic_scheduling/apps/schedule/views.py create mode 100644 polyclinic_scheduling/lib/models/base.py create mode 100644 polyclinic_scheduling/locale/en/LC_MESSAGES/django.po create mode 100644 polyclinic_scheduling/locale/nl/LC_MESSAGES/django.po create mode 100755 polyclinic_scheduling/manage.py create mode 100644 polyclinic_scheduling/polyclinic_scheduling/.env.example create mode 100644 polyclinic_scheduling/polyclinic_scheduling/__init__.py create mode 100644 polyclinic_scheduling/polyclinic_scheduling/asgi.py create mode 100644 polyclinic_scheduling/polyclinic_scheduling/settings.py create mode 100644 polyclinic_scheduling/polyclinic_scheduling/urls.py create mode 100644 polyclinic_scheduling/polyclinic_scheduling/wsgi.py create mode 100644 polyclinic_scheduling/templates/menu.html create mode 100644 polyclinic_scheduling/templates/singup.html create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..374c8fd --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +.vscode +python3_env +test +*.pyc +*.mo +db.sqlite3 +.env diff --git a/polyclinic_scheduling/apps/RUG_template/__init__.py b/polyclinic_scheduling/apps/RUG_template/__init__.py new file mode 100644 index 0000000..4d348bc --- /dev/null +++ b/polyclinic_scheduling/apps/RUG_template/__init__.py @@ -0,0 +1 @@ +default_app_config = 'apps.RUG_template.apps.RugTemplateConfig' \ No newline at end of file diff --git a/polyclinic_scheduling/apps/RUG_template/admin.py b/polyclinic_scheduling/apps/RUG_template/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/polyclinic_scheduling/apps/RUG_template/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/polyclinic_scheduling/apps/RUG_template/apps.py b/polyclinic_scheduling/apps/RUG_template/apps.py new file mode 100644 index 0000000..0b1d282 --- /dev/null +++ b/polyclinic_scheduling/apps/RUG_template/apps.py @@ -0,0 +1,8 @@ +from django.apps import AppConfig +from django.utils.translation import ugettext_lazy as _ + +class RugTemplateConfig(AppConfig): + name = 'apps.RUG_template' + label = 'RUG_template' + verbose_name = _('RUG_template') + verbose_name_plural = _('RUG_template') diff --git a/polyclinic_scheduling/apps/RUG_template/migrations/__init__.py b/polyclinic_scheduling/apps/RUG_template/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/polyclinic_scheduling/apps/RUG_template/models.py b/polyclinic_scheduling/apps/RUG_template/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/polyclinic_scheduling/apps/RUG_template/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/polyclinic_scheduling/apps/RUG_template/static/RUG_template/css/base.css b/polyclinic_scheduling/apps/RUG_template/static/RUG_template/css/base.css new file mode 100644 index 0000000..142a595 --- /dev/null +++ b/polyclinic_scheduling/apps/RUG_template/static/RUG_template/css/base.css @@ -0,0 +1,24 @@ +.rug-wrapper { + max-width: 80% !important; +} + +.rug-width-m-8-24 { + width: 25%; +} + +.rug-panel--content { + max-width: none; +} + +.rug-nav--main__item { + display: none; +} + +.rug-nav--main__item:first-of-type, +.rug-nav--main__item:last-of-type { + display: block; +} + +.rug-breadcrumbs { + display: none; +} \ No newline at end of file diff --git a/polyclinic_scheduling/apps/RUG_template/templates/base.html b/polyclinic_scheduling/apps/RUG_template/templates/base.html new file mode 100644 index 0000000..116e610 --- /dev/null +++ b/polyclinic_scheduling/apps/RUG_template/templates/base.html @@ -0,0 +1,608 @@ +{% load static %} +{% load i18n %} + + + + + {% block title %}{% trans "Welcome at RUG" %}{% endblock %} + + + + + + + + + + + + + + + + + + + + +{% comment %} + +{% endcomment %} + + + + + + + + + + + + + + + + + + + + + + + + + + + Skip to ContentSkip to Navigation + +
+
+
+ Rijksuniversiteit Groningenfounded in 1614  -  top 100 university + + + +
+
+ + +
+
+ + +
+
+
+
+
+ + + +
+
+ + +
+

+{% block pagetitle %} -=PageTitle=- {% endblock %} +

+
+
+ +
+{% if messages %} + {% for message in messages %} + + {% endfor %} +{% endif %} +
+
+{% block content %} -=PageContent=- {% endblock %} +
+
+ +
+
+ +
+ +
+print +
+ +
+
+
+
+ +
+
+
+ +
+
+ + + diff --git a/polyclinic_scheduling/apps/RUG_template/templates/index.html b/polyclinic_scheduling/apps/RUG_template/templates/index.html new file mode 100644 index 0000000..a9987e0 --- /dev/null +++ b/polyclinic_scheduling/apps/RUG_template/templates/index.html @@ -0,0 +1,11 @@ +{% extends 'base.html' %} +{% load i18n %} + +{% block title %}{% trans "Welcome to the RUG Template page" %}{% endblock %} +{% block pagetitle %}{% trans "Welcome to the RUG Template page" %}{% endblock %} +{% block content %} +

+{% trans "Simple RUG Template" %} +

+

{% trans "Some more text" %}

+{% endblock %} \ No newline at end of file diff --git a/polyclinic_scheduling/apps/RUG_template/templates/menu.html b/polyclinic_scheduling/apps/RUG_template/templates/menu.html new file mode 100644 index 0000000..3e9334a --- /dev/null +++ b/polyclinic_scheduling/apps/RUG_template/templates/menu.html @@ -0,0 +1,13 @@ +{% load i18n %} + +
  • +{% trans "Section" %} + + +
  • diff --git a/polyclinic_scheduling/apps/RUG_template/templates/pager.html b/polyclinic_scheduling/apps/RUG_template/templates/pager.html new file mode 100644 index 0000000..b5c35e2 --- /dev/null +++ b/polyclinic_scheduling/apps/RUG_template/templates/pager.html @@ -0,0 +1,29 @@ +{% load i18n %} + +{% if page_obj.paginator.num_pages > 1 %} + +{% endif %} \ No newline at end of file diff --git a/polyclinic_scheduling/apps/RUG_template/templates/registration/login.html b/polyclinic_scheduling/apps/RUG_template/templates/registration/login.html new file mode 100644 index 0000000..50d2086 --- /dev/null +++ b/polyclinic_scheduling/apps/RUG_template/templates/registration/login.html @@ -0,0 +1,24 @@ +{% extends 'base.html' %} +{% load i18n %} + +{% block title %}{% trans "Login" %}{% endblock %} +{% block pagetitle %}{% trans "Login" %}{% endblock %} +{% block content %} +

    +{% trans "Login" %} +

    + +
    + {% csrf_token %} + + + {{ form.as_table }} + + + +
    +
    + +{# Assumes you setup the password_reset view in your URLconf #} +

    {% trans "Lost password?" %}

    +{% endblock %} \ No newline at end of file diff --git a/polyclinic_scheduling/apps/RUG_template/templates/registration/password_reset_complete.html b/polyclinic_scheduling/apps/RUG_template/templates/registration/password_reset_complete.html new file mode 100644 index 0000000..89becc9 --- /dev/null +++ b/polyclinic_scheduling/apps/RUG_template/templates/registration/password_reset_complete.html @@ -0,0 +1,12 @@ +{% extends 'base.html' %} +{% load i18n %} + +{% block title %}{% trans "Password reset complete" %}{% endblock %} +{% block pagetitle %}{% trans "Password reset complete" %}{% endblock %} +{% block content %} +

    +{% trans "Password reset complete" %} +
    +

    Your new password has been set. You can log in now on the log in page.

    +

    +{% endblock %} diff --git a/polyclinic_scheduling/apps/RUG_template/templates/registration/password_reset_confirm.html b/polyclinic_scheduling/apps/RUG_template/templates/registration/password_reset_confirm.html new file mode 100644 index 0000000..a89576a --- /dev/null +++ b/polyclinic_scheduling/apps/RUG_template/templates/registration/password_reset_confirm.html @@ -0,0 +1,25 @@ +{% extends 'base.html' %} +{% load i18n %} + +{% block title %}{% trans "Set a new password!" %}{% endblock %} +{% block pagetitle %}{% trans "Set a new password!" %}{% endblock %} +{% block content %} +

    +{% trans "Set a new password!" %} +{% if validlink %} +

    + + {% csrf_token %} + {{ form.as_table }} + + + +
    + +
    +
    +{% else %} +

    {% trans "The password reset link was invalid, possibly because it has already been used. Please request a new password reset." %}

    +{% endif %} +

    +{% endblock %} diff --git a/polyclinic_scheduling/apps/RUG_template/templates/registration/password_reset_done.html b/polyclinic_scheduling/apps/RUG_template/templates/registration/password_reset_done.html new file mode 100644 index 0000000..59135be --- /dev/null +++ b/polyclinic_scheduling/apps/RUG_template/templates/registration/password_reset_done.html @@ -0,0 +1,13 @@ +{% extends 'base.html' %} +{% load i18n %} + +{% block title %}{% trans "Reset password, email sent" %}{% endblock %} +{% block pagetitle %}{% trans "Reset password, email sent" %}{% endblock %} +{% block content %} +

    +{% trans "Reset password, email sent" %} +
    +
    +We've emailed you instructions for setting your password. You should receive the email shortly! +

    +{% endblock %} \ No newline at end of file diff --git a/polyclinic_scheduling/apps/RUG_template/templates/registration/password_reset_form.html b/polyclinic_scheduling/apps/RUG_template/templates/registration/password_reset_form.html new file mode 100644 index 0000000..a199ca4 --- /dev/null +++ b/polyclinic_scheduling/apps/RUG_template/templates/registration/password_reset_form.html @@ -0,0 +1,24 @@ +{% extends 'base.html' %} +{% load i18n %} + +{% block title %}{% trans "Reset password" %}{% endblock %} +{% block pagetitle %}{% trans "Reset password" %}{% endblock %} +{% block content %} +

    +{% trans "Reset password" %} +

    + + +
    +{% csrf_token %} + + + + + +
    {{ form.email.label_tag }}{{ form.email }}
    + + +
    + +{% endblock %} diff --git a/polyclinic_scheduling/apps/RUG_template/templates/singup.html b/polyclinic_scheduling/apps/RUG_template/templates/singup.html new file mode 100644 index 0000000..d0be6fb --- /dev/null +++ b/polyclinic_scheduling/apps/RUG_template/templates/singup.html @@ -0,0 +1,20 @@ +{% extends 'base.html' %} +{% load i18n %} + +{% block title %}{% trans "Singup" %}{% endblock %} +{% block pagetitle %}{% trans "Singup" %}{% endblock %} +{% block content %} +

    +{% trans "Singup" %} +

    + +
    + {% csrf_token %} + + {{ form.as_table }} + + + +
    +
    +{% endblock %} \ No newline at end of file diff --git a/polyclinic_scheduling/apps/RUG_template/tests.py b/polyclinic_scheduling/apps/RUG_template/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/polyclinic_scheduling/apps/RUG_template/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/polyclinic_scheduling/apps/RUG_template/urls.py b/polyclinic_scheduling/apps/RUG_template/urls.py new file mode 100644 index 0000000..6a0d1d2 --- /dev/null +++ b/polyclinic_scheduling/apps/RUG_template/urls.py @@ -0,0 +1,7 @@ +from django.urls import path, include + +from . import views + +urlpatterns = [ + path('', views.index, name='index'), +] \ No newline at end of file diff --git a/polyclinic_scheduling/apps/RUG_template/views.py b/polyclinic_scheduling/apps/RUG_template/views.py new file mode 100644 index 0000000..8832c3a --- /dev/null +++ b/polyclinic_scheduling/apps/RUG_template/views.py @@ -0,0 +1,7 @@ +from django.shortcuts import render + +# Create your views here. +def index(request): + template_name = 'index.html' + + return render(request, template_name, {}) \ No newline at end of file diff --git a/polyclinic_scheduling/apps/employee/__init__.py b/polyclinic_scheduling/apps/employee/__init__.py new file mode 100644 index 0000000..7d4878f --- /dev/null +++ b/polyclinic_scheduling/apps/employee/__init__.py @@ -0,0 +1 @@ +default_app_config = 'apps.employee.apps.EmployeeConfig' \ No newline at end of file diff --git a/polyclinic_scheduling/apps/employee/admin.py b/polyclinic_scheduling/apps/employee/admin.py new file mode 100644 index 0000000..24bc992 --- /dev/null +++ b/polyclinic_scheduling/apps/employee/admin.py @@ -0,0 +1,20 @@ +from django.contrib import admin +from django.contrib.auth.admin import UserAdmin as BaseUserAdmin +from django.contrib.auth.models import User + +from .models import Employee + +# Define an inline admin descriptor for Employee model +# which acts a bit like a singleton +class EmployeeInline(admin.StackedInline): + model = Employee + can_delete = False + verbose_name_plural = 'employee' + +# Define a new User admin +class UserAdmin(BaseUserAdmin): + inlines = (EmployeeInline,) + +# Re-register UserAdmin +admin.site.unregister(User) +admin.site.register(User, UserAdmin) \ No newline at end of file diff --git a/polyclinic_scheduling/apps/employee/apps.py b/polyclinic_scheduling/apps/employee/apps.py new file mode 100644 index 0000000..34da09e --- /dev/null +++ b/polyclinic_scheduling/apps/employee/apps.py @@ -0,0 +1,8 @@ +from django.apps import AppConfig +from django.utils.translation import ugettext_lazy as _ + +class EmployeeConfig(AppConfig): + name = 'apps.employee' + label = 'employee' + verbose_name = _('Employee') + verbose_name_plural = _('Employees') diff --git a/polyclinic_scheduling/apps/employee/migrations/0001_initial.py b/polyclinic_scheduling/apps/employee/migrations/0001_initial.py new file mode 100644 index 0000000..34541d4 --- /dev/null +++ b/polyclinic_scheduling/apps/employee/migrations/0001_initial.py @@ -0,0 +1,34 @@ +# Generated by Django 3.0.6 on 2020-05-13 13:33 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('polyclinic', '0001_initial'), + ('hospital', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='Employee', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('created_at', models.DateTimeField(auto_now_add=True, help_text='The date and time this model has been created', verbose_name='Date created')), + ('updated_at', models.DateTimeField(auto_now=True, help_text='The date and time this model has been updated', verbose_name='Date updated')), + ('phone', models.CharField(blank=True, help_text='The direct phone number of this employee', max_length=15, verbose_name='Phone number')), + ('hospital', models.ForeignKey(help_text='Select the hospital for this employee', on_delete=django.db.models.deletion.CASCADE, to='hospital.Hospital')), + ('polyclinic', models.ManyToManyField(blank=True, help_text='Select the polyclinic(s) for this employee', to='polyclinic.Polyclinic')), + ('user', models.OneToOneField(help_text='Django user', on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + options={ + 'abstract': False, + }, + ), + ] diff --git a/polyclinic_scheduling/apps/employee/migrations/__init__.py b/polyclinic_scheduling/apps/employee/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/polyclinic_scheduling/apps/employee/models.py b/polyclinic_scheduling/apps/employee/models.py new file mode 100644 index 0000000..726398d --- /dev/null +++ b/polyclinic_scheduling/apps/employee/models.py @@ -0,0 +1,20 @@ +from django.db import models +from django.contrib.auth.models import User +from django.utils.translation import gettext_lazy as _ + +from lib.models.base import MetaDataModel +from apps.hospital.models import Hospital +from apps.polyclinic.models import Polyclinic + +# Create your models here. +class Employee(MetaDataModel): + user = models.OneToOneField(User, on_delete=models.CASCADE, help_text=_('Django user')) + + hospital = models.ForeignKey(Hospital, on_delete=models.CASCADE, help_text=_('Select the hospital for this employee')) + + polyclinic = models.ManyToManyField(Polyclinic, blank=True, help_text=_('Select the polyclinic(s) for this employee')) + phone = models.CharField(_('Phone number'), max_length=15, blank=True, help_text=_('The direct phone number of this employee')) + + def __str__(self): + """str: Returns a readable name for the hospital. Format is [hospital_name] ([city]).""" + return '{} ({})'.format(self.user.get_full_name(), self.hospital) \ No newline at end of file diff --git a/polyclinic_scheduling/apps/employee/tests.py b/polyclinic_scheduling/apps/employee/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/polyclinic_scheduling/apps/employee/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/polyclinic_scheduling/apps/employee/views.py b/polyclinic_scheduling/apps/employee/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/polyclinic_scheduling/apps/employee/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/polyclinic_scheduling/apps/hospital/__init__.py b/polyclinic_scheduling/apps/hospital/__init__.py new file mode 100644 index 0000000..65a0963 --- /dev/null +++ b/polyclinic_scheduling/apps/hospital/__init__.py @@ -0,0 +1 @@ +default_app_config = 'apps.hospital.apps.HospitalConfig' \ No newline at end of file diff --git a/polyclinic_scheduling/apps/hospital/admin.py b/polyclinic_scheduling/apps/hospital/admin.py new file mode 100644 index 0000000..627278e --- /dev/null +++ b/polyclinic_scheduling/apps/hospital/admin.py @@ -0,0 +1,10 @@ +from django.contrib import admin + +from .models import Hospital + +# Register your models here. +@admin.register(Hospital) +class HospitalAdmin(admin.ModelAdmin): + list_display = ('name', 'address', 'postal_code', 'city', 'phone', 'created_at') + ordering = ('name', 'city', 'created_at','updated_at') + search_fields = ('name', 'address','postal_code','city', 'phone') diff --git a/polyclinic_scheduling/apps/hospital/apps.py b/polyclinic_scheduling/apps/hospital/apps.py new file mode 100644 index 0000000..02555cc --- /dev/null +++ b/polyclinic_scheduling/apps/hospital/apps.py @@ -0,0 +1,8 @@ +from django.apps import AppConfig +from django.utils.translation import ugettext_lazy as _ + +class HospitalConfig(AppConfig): + name = 'apps.hospital' + label = 'hospital' + verbose_name = _('Hospital') + verbose_name_plural = _('Hospitals') diff --git a/polyclinic_scheduling/apps/hospital/migrations/0001_initial.py b/polyclinic_scheduling/apps/hospital/migrations/0001_initial.py new file mode 100644 index 0000000..9de7189 --- /dev/null +++ b/polyclinic_scheduling/apps/hospital/migrations/0001_initial.py @@ -0,0 +1,30 @@ +# Generated by Django 3.0.6 on 2020-05-13 13:33 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Hospital', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('created_at', models.DateTimeField(auto_now_add=True, help_text='The date and time this model has been created', verbose_name='Date created')), + ('updated_at', models.DateTimeField(auto_now=True, help_text='The date and time this model has been updated', verbose_name='Date updated')), + ('name', models.CharField(help_text='The name of this hospital', max_length=200, verbose_name='Name')), + ('address', models.CharField(blank=True, help_text='The address of this hospital', max_length=200, verbose_name='Address')), + ('postal_code', models.CharField(blank=True, help_text='The postal code of this hospital', max_length=10, verbose_name='Postal code')), + ('city', models.CharField(blank=True, help_text='The city of this hospital', max_length=60, verbose_name='City')), + ('phone', models.CharField(blank=True, help_text='The general phone number of this hospital', max_length=18, verbose_name='Phone number')), + ], + options={ + 'abstract': False, + }, + ), + ] diff --git a/polyclinic_scheduling/apps/hospital/migrations/__init__.py b/polyclinic_scheduling/apps/hospital/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/polyclinic_scheduling/apps/hospital/models.py b/polyclinic_scheduling/apps/hospital/models.py new file mode 100644 index 0000000..25bafd3 --- /dev/null +++ b/polyclinic_scheduling/apps/hospital/models.py @@ -0,0 +1,16 @@ +from django.db import models +from django.utils.translation import gettext_lazy as _ + +from lib.models.base import MetaDataModel + +# Create your models here. +class Hospital(MetaDataModel): + name = models.CharField(_('Name'), max_length=200, help_text=_('The name of this hospital')) + address = models.CharField(_('Address'), max_length=200, blank=True, help_text=_('The address of this hospital')) + postal_code = models.CharField(_('Postal code'), max_length=10, blank=True, help_text=_('The postal code of this hospital')) + city = models.CharField(_('City'), max_length=60, blank=True, help_text=_('The city of this hospital')) + phone = models.CharField(_('Phone number'), max_length=18, blank=True, help_text=_('The general phone number of this hospital')) + + def __str__(self): + """str: Returns a readable name for the hospital. Format is [hospital_name] ([city]).""" + return '{}{}'.format(self.name, ('' if not self.city else ' ({})'.format(self.city))) \ No newline at end of file diff --git a/polyclinic_scheduling/apps/hospital/tests.py b/polyclinic_scheduling/apps/hospital/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/polyclinic_scheduling/apps/hospital/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/polyclinic_scheduling/apps/hospital/views.py b/polyclinic_scheduling/apps/hospital/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/polyclinic_scheduling/apps/hospital/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/polyclinic_scheduling/apps/polyclinic/__init__.py b/polyclinic_scheduling/apps/polyclinic/__init__.py new file mode 100644 index 0000000..83de1d1 --- /dev/null +++ b/polyclinic_scheduling/apps/polyclinic/__init__.py @@ -0,0 +1 @@ +default_app_config = 'apps.polyclinic.apps.PolyclinicConfig' \ No newline at end of file diff --git a/polyclinic_scheduling/apps/polyclinic/admin.py b/polyclinic_scheduling/apps/polyclinic/admin.py new file mode 100644 index 0000000..dcb5e0a --- /dev/null +++ b/polyclinic_scheduling/apps/polyclinic/admin.py @@ -0,0 +1,10 @@ +from django.contrib import admin + +from .models import Polyclinic + +# Register your models here. +@admin.register(Polyclinic) +class PolyclinicAdmin(admin.ModelAdmin): + list_display = ('name', 'phone', 'created_at') + ordering = ('name', 'created_at','updated_at') + search_fields = ('name', 'phone') diff --git a/polyclinic_scheduling/apps/polyclinic/apps.py b/polyclinic_scheduling/apps/polyclinic/apps.py new file mode 100644 index 0000000..cc61ebf --- /dev/null +++ b/polyclinic_scheduling/apps/polyclinic/apps.py @@ -0,0 +1,8 @@ +from django.apps import AppConfig +from django.utils.translation import ugettext_lazy as _ + +class PolyclinicConfig(AppConfig): + name = 'apps.polyclinic' + label = 'polyclinic' + verbose_name = _('Polyclinic') + verbose_name_plural = _('Polyclinics') diff --git a/polyclinic_scheduling/apps/polyclinic/migrations/0001_initial.py b/polyclinic_scheduling/apps/polyclinic/migrations/0001_initial.py new file mode 100644 index 0000000..30bff66 --- /dev/null +++ b/polyclinic_scheduling/apps/polyclinic/migrations/0001_initial.py @@ -0,0 +1,30 @@ +# Generated by Django 3.0.6 on 2020-05-13 13:33 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('hospital', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='Polyclinic', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('created_at', models.DateTimeField(auto_now_add=True, help_text='The date and time this model has been created', verbose_name='Date created')), + ('updated_at', models.DateTimeField(auto_now=True, help_text='The date and time this model has been updated', verbose_name='Date updated')), + ('name', models.CharField(blank=True, help_text='The name of this polyclinic', max_length=200, verbose_name='Name')), + ('phone', models.CharField(blank=True, help_text='The general/direct phone number of this polyclinic', max_length=18, verbose_name='Phone number')), + ('hospital', models.ForeignKey(help_text='To which hospital belongs this polyclinic', on_delete=django.db.models.deletion.CASCADE, to='hospital.Hospital')), + ], + options={ + 'abstract': False, + }, + ), + ] diff --git a/polyclinic_scheduling/apps/polyclinic/migrations/__init__.py b/polyclinic_scheduling/apps/polyclinic/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/polyclinic_scheduling/apps/polyclinic/models.py b/polyclinic_scheduling/apps/polyclinic/models.py new file mode 100644 index 0000000..0c0bbe5 --- /dev/null +++ b/polyclinic_scheduling/apps/polyclinic/models.py @@ -0,0 +1,15 @@ +from django.db import models +from django.utils.translation import gettext_lazy as _ + +from lib.models.base import MetaDataModel +from apps.hospital.models import Hospital +# Create your models here. + +class Polyclinic(MetaDataModel): + hospital = models.ForeignKey(Hospital, on_delete=models.CASCADE, help_text=_('To which hospital belongs this polyclinic')) + name = models.CharField(_('Name'), max_length=200, blank=True, help_text=_('The name of this polyclinic')) + phone = models.CharField(_('Phone number'), max_length=18, blank=True, help_text=_('The general/direct phone number of this polyclinic')) + + def __str__(self): + """str: Returns a readable name for the hospital. Format is [hospital_name] ([city]).""" + return '{} ({})'.format(self.name, self.hospital) diff --git a/polyclinic_scheduling/apps/polyclinic/tests.py b/polyclinic_scheduling/apps/polyclinic/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/polyclinic_scheduling/apps/polyclinic/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/polyclinic_scheduling/apps/polyclinic/views.py b/polyclinic_scheduling/apps/polyclinic/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/polyclinic_scheduling/apps/polyclinic/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/polyclinic_scheduling/apps/schedule/__init__.py b/polyclinic_scheduling/apps/schedule/__init__.py new file mode 100644 index 0000000..1000104 --- /dev/null +++ b/polyclinic_scheduling/apps/schedule/__init__.py @@ -0,0 +1 @@ +default_app_config = 'apps.schedule.apps.ScheduleConfig' \ No newline at end of file diff --git a/polyclinic_scheduling/apps/schedule/admin.py b/polyclinic_scheduling/apps/schedule/admin.py new file mode 100644 index 0000000..867e283 --- /dev/null +++ b/polyclinic_scheduling/apps/schedule/admin.py @@ -0,0 +1,15 @@ +from django.contrib import admin + +from .models import Schedule + +# Register your models here. +@admin.register(Schedule) +class ScheduleAdmin(admin.ModelAdmin): + list_display = ('name', 'employee', 'email', 'created_at', 'processed') + ordering = ('name', 'created_at') + search_fields = ('name', 'email') + + def processed(self,obj): + return len(obj.output_peregrine) > 0 + + processed.boolean = True diff --git a/polyclinic_scheduling/apps/schedule/apps.py b/polyclinic_scheduling/apps/schedule/apps.py new file mode 100644 index 0000000..ee3da72 --- /dev/null +++ b/polyclinic_scheduling/apps/schedule/apps.py @@ -0,0 +1,8 @@ +from django.apps import AppConfig +from django.utils.translation import ugettext_lazy as _ + +class ScheduleConfig(AppConfig): + name = 'apps.schedule' + label = 'schedule' + verbose_name = _('Schedule') + verbose_name_plural = _('Schedules') diff --git a/polyclinic_scheduling/apps/schedule/forms.py b/polyclinic_scheduling/apps/schedule/forms.py new file mode 100644 index 0000000..6c630e2 --- /dev/null +++ b/polyclinic_scheduling/apps/schedule/forms.py @@ -0,0 +1,9 @@ +from django import forms +from django.utils.translation import gettext_lazy as _ + +from .models import Schedule + +class ScheduleForm(forms.Form): + name = forms.CharField(label=_('Department name'), help_text=_('Enter a descriptive name for this schedule'), max_length=100) + email = forms.CharField(label=_('Email address for results'), help_text=_('When the job is done, the results will be sent to this email address'), max_length=100) + json = forms.CharField(label=_('Email address for results'), help_text=_('When the job is done, the results will be sent to this email address'), widget=forms.HiddenInput(), strip=True) \ No newline at end of file diff --git a/polyclinic_scheduling/apps/schedule/migrations/0001_initial.py b/polyclinic_scheduling/apps/schedule/migrations/0001_initial.py new file mode 100644 index 0000000..2563b9f --- /dev/null +++ b/polyclinic_scheduling/apps/schedule/migrations/0001_initial.py @@ -0,0 +1,36 @@ +# Generated by Django 3.0.6 on 2020-05-13 13:33 + +import collections +from django.db import migrations, models +import django.db.models.deletion +import jsonfield.fields + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('employee', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='Schedule', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('created_at', models.DateTimeField(auto_now_add=True, help_text='The date and time this model has been created', verbose_name='Date created')), + ('updated_at', models.DateTimeField(auto_now=True, help_text='The date and time this model has been updated', verbose_name='Date updated')), + ('name', models.CharField(help_text='Name of the schedule', max_length=100, verbose_name='Name')), + ('email', models.CharField(help_text='Email address where the results will be sent to.', max_length=100, verbose_name='Email address')), + ('planning_source', jsonfield.fields.JSONField(blank=True, help_text='The schedule input in JSON format based on the form data', load_kwargs={'object_pairs_hook': collections.OrderedDict}, verbose_name='Schedule input')), + ('planning_peregrine', models.TextField(blank=True, help_text='This is the translated content from the source for use with Peregrine cluster', verbose_name='Peregrine input')), + ('peregrine_accepted', models.BooleanField(default=False, help_text='When true, the Peregrine cluster has picked up the job.', verbose_name='Peregrine accepted')), + ('output_peregrine', models.BinaryField(blank=True, help_text='This is the output in binary format from the Peregrine cluster', verbose_name='Peregrine binary output')), + ('employee', models.ForeignKey(help_text='Select the employee that is responsible for this schedule request', on_delete=django.db.models.deletion.CASCADE, to='employee.Employee')), + ], + options={ + 'abstract': False, + }, + ), + ] diff --git a/polyclinic_scheduling/apps/schedule/migrations/__init__.py b/polyclinic_scheduling/apps/schedule/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/polyclinic_scheduling/apps/schedule/models.py b/polyclinic_scheduling/apps/schedule/models.py new file mode 100644 index 0000000..88a678f --- /dev/null +++ b/polyclinic_scheduling/apps/schedule/models.py @@ -0,0 +1,26 @@ +from django.db import models +from django.utils.translation import gettext_lazy as _ + +from lib.models.base import MetaDataModel +from apps.employee.models import Employee + +from jsonfield import JSONField +import collections + +# Create your models here. +class Schedule(MetaDataModel): + employee = models.ForeignKey(Employee, on_delete=models.CASCADE, help_text=_('Select the employee that is responsible for this schedule request')) + + name = models.CharField(_('Name'), max_length=100, help_text=_('Name of the schedule')) + email = models.CharField(_('Email address'), max_length=100, help_text=_('Email address where the results will be sent to.')) + + planning_source = JSONField(_('Schedule input'), blank=True, load_kwargs={'object_pairs_hook': collections.OrderedDict}, help_text=_('The schedule input in JSON format based on the form data')) + planning_peregrine = models.TextField(_('Peregrine input'), blank=True, help_text=_('This is the translated content from the source for use with Peregrine cluster')) + + peregrine_accepted = models.BooleanField(_('Peregrine accepted'),default=False, help_text=_('When true, the Peregrine cluster has picked up the job.')) + + output_peregrine = models.BinaryField(_('Peregrine binary output'), blank=True, help_text=_('This is the output in binary format from the Peregrine cluster')) + + def __str__(self): + """str: Returns a readable name for the schedule. Format is [schedule_name] (employee_name).""" + return '{} ({})'.format(self.name, self.employee) \ No newline at end of file diff --git a/polyclinic_scheduling/apps/schedule/templates/schedule/schedule_list.html b/polyclinic_scheduling/apps/schedule/templates/schedule/schedule_list.html new file mode 100644 index 0000000..3fcdb3e --- /dev/null +++ b/polyclinic_scheduling/apps/schedule/templates/schedule/schedule_list.html @@ -0,0 +1,37 @@ +{% extends 'base.html' %} +{% load i18n %} + +{% block title %}{% trans "Schedules overview list" %}{% endblock %} +{% block pagetitle %}{% trans "Schedules overview list" %}{% endblock %} +{% block content %} +

    +{% trans "Schedules overview list" %} + + + {% comment %} {% endcomment %} + + + + + + + {% for schedule in object_list %} + + {% comment %} {% endcomment %} + + + + + + + {% empty %} + + + + {% endfor %} +
    {% trans "Department" %}{% trans "Name" %}{% trans "Created" %}{% trans "Updated" %}{% trans "Running" %}{% trans "Report" %}
    {{ schedule.name }}{% comment %}{% endcomment %}{{ schedule.name }}{% comment %}{% endcomment %}{{ schedule.created_at|date:"SHORT_DATETIME_FORMAT" }}{{ schedule.updated_at|date:"SHORT_DATETIME_FORMAT" }}NoneNone
    {% trans "No schedules available" %}
    +
    +
    +{% include "pager.html" %} +

    +{% endblock %} diff --git a/polyclinic_scheduling/apps/schedule/templates/schedule/schedule_new.html b/polyclinic_scheduling/apps/schedule/templates/schedule/schedule_new.html new file mode 100644 index 0000000..85ad6fc --- /dev/null +++ b/polyclinic_scheduling/apps/schedule/templates/schedule/schedule_new.html @@ -0,0 +1,650 @@ +{% extends 'base.html' %} +{% load i18n %} + +{% block title %}{% trans "New schedule" %}{% endblock %} +{% block pagetitle %}{% trans "New schedule" %}{% endblock %} +{% block content %} + +
    +
    + {% csrf_token %} + {{ form.json }} +

    Algemene informatie

    +

    Als een afdeling meerdere wachtkamers heeft, vul dan dit formulier meerdere keren in; een keer voor elke groep van behandelkamers die een wachtkamer delen.

    +
    + + + Geef de naam op van de afdeling +
    +
    + + + Geef het emailadres op om de uitkomsten te ontvangen +
    +
    + + + Met bewaren 1,5m afstand tussen lopende en zittende patiënten! +
    +
    +
    +
    +

    Specialisaties binnen de afdeling

    +
    +
    + + + Verwijder +
    +
    + + + Geef een afkorting op voor deze specialisatie. Deze gebruiken wij in de figuren van de rapportage. +
    +
    + + + Maximaal aantal artsen dat op enig moment tegelijk aan het werk zou kunnen zijn. +
    +
    + + + Aantal behandelkamers dat beschikbaar is per specialisatie +
    +
    + + + +
    +
    + + +
    +
    +
    de hele werkdag
    +
    + +
    +
    + +
    +
    +
    +
    ochtendpauze
    +
    + +
    +
    + +
    +
    +
    +
    lunchpauze
    +
    + +
    +
    + +
    +
    +
    +
    middagpauze
    +
    + +
    +
    + +
    +
    +
    +
    +
    + + +
    +
    +
    + +

    Behandelingen

    +

    In het model worden slots van 5 minuten gebruikt voor het bepalen van starttijden. etc. Afspraken starten daarmee om bijv. 10.00, 10.05, 10.10.
    Afspraakduur wordt daarmee ook in veelvouden van 5 minuten gevraagd.

    +

    Zowel afspraken waar de patiënt fysiek in het ziekenhuis is, als wel telefoongesprekken worden hier gevraagd. Beide type afspraken kunnen in het raster worden gepland.

    +

    "Normaal" betekent: zoals het was voor COVID-19
    30% betekent: als je maar 30% van de patiënten kunt binnenkrijgen, hoeveel afspraken van elk type zou je dan willen inplannen?

    +
    +
    +
    Naam behandeling
    +
    Duur (in minuten)
    +
    Specialisatie
    +
    Methode
    +
    Normaal aantal
    +
    Gewenst als op 30%
    +
    + +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    + + Verwijder +
    +
    +
    +
    + + + +
    +
    Totaal aantal afspraken
    +
    0
    +
    0
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    + + + + + + + + +{% endblock %} diff --git a/polyclinic_scheduling/apps/schedule/tests.py b/polyclinic_scheduling/apps/schedule/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/polyclinic_scheduling/apps/schedule/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/polyclinic_scheduling/apps/schedule/urls.py b/polyclinic_scheduling/apps/schedule/urls.py new file mode 100644 index 0000000..f554c66 --- /dev/null +++ b/polyclinic_scheduling/apps/schedule/urls.py @@ -0,0 +1,9 @@ +from django.urls import path, include + +from . import views + +app_name = 'schedule' +urlpatterns = [ + path('', views.ScheduleListView.as_view(), name='list'), + path('new', views.new_or_update_study, name='new'), +] \ No newline at end of file diff --git a/polyclinic_scheduling/apps/schedule/views.py b/polyclinic_scheduling/apps/schedule/views.py new file mode 100644 index 0000000..c0a88fb --- /dev/null +++ b/polyclinic_scheduling/apps/schedule/views.py @@ -0,0 +1,50 @@ +from django.shortcuts import render, redirect + +from django.views.generic.list import ListView +from django.contrib.auth.mixins import LoginRequiredMixin +from django.contrib.auth.decorators import login_required + +from .models import Schedule +from .forms import ScheduleForm + +import json + +# Create your views here. +class ScheduleListView(LoginRequiredMixin,ListView): + + model = Schedule + paginate_by = 10 + + def get_queryset(self): + return Schedule.objects.filter(employee=self.request.user.employee).order_by('-created_at') + +@login_required +def new_or_update_study(request, schedule = None): + template_name = 'schedule/schedule_new.html' + + if request.method == 'POST': + schedule_form = ScheduleForm(request.POST) + + if schedule_form.is_valid(): + new_schedule = Schedule() + + try: + new_schedule.planning_source = json.loads(schedule_form.cleaned_data['json']) + except json.JSONDecodeError as ex: + # For now, sorry, ignore + pass + + new_schedule.employee = request.user.employee + new_schedule.name = schedule_form.cleaned_data['name'] + new_schedule.email = schedule_form.cleaned_data['email'] + + new_schedule.save() + + return redirect('schedule:list') + + else: + schedule_form = ScheduleForm() + + return render(request, template_name, { + 'form' : schedule_form, + }) \ No newline at end of file diff --git a/polyclinic_scheduling/lib/models/base.py b/polyclinic_scheduling/lib/models/base.py new file mode 100644 index 0000000..294dae6 --- /dev/null +++ b/polyclinic_scheduling/lib/models/base.py @@ -0,0 +1,20 @@ + +from django.db import models +from django.utils.translation import gettext_lazy as _ + +class MetaDataModel(models.Model): + """ + This is an abstract model with some general meta fields. + + Attributes + ---------- + created_at : datetime + The date and time when the model has been created. This will be automatically set once during creating. + updated_at : datetime + The date and time when the model has been updated. This will be automatically updated when the model is updated. + """ + created_at = models.DateTimeField(_('Date created'),auto_now_add=True, help_text=_('The date and time this model has been created')) + updated_at = models.DateTimeField(_('Date updated'),auto_now=True, help_text=_('The date and time this model has been updated')) + + class Meta: + abstract = True \ No newline at end of file diff --git a/polyclinic_scheduling/locale/en/LC_MESSAGES/django.po b/polyclinic_scheduling/locale/en/LC_MESSAGES/django.po new file mode 100644 index 0000000..e04074f --- /dev/null +++ b/polyclinic_scheduling/locale/en/LC_MESSAGES/django.po @@ -0,0 +1,318 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-05-13 08:34+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: apps/RUG_template/apps.py:7 apps/RUG_template/apps.py:8 +msgid "RUG_template" +msgstr "" + +#: apps/RUG_template/templates/base.html:7 +msgid "Welcome at RUG Data drop" +msgstr "" + +#: apps/RUG_template/templates/base.html:84 +msgid "Language selection" +msgstr "" + +#: apps/RUG_template/templates/index.html:4 +#: apps/RUG_template/templates/index.html:5 +msgid "Welcome to the RUG Template page" +msgstr "" + +#: apps/RUG_template/templates/index.html:8 +msgid "Simple RUG Template" +msgstr "" + +#: apps/RUG_template/templates/index.html:10 +msgid "Some more text" +msgstr "" + +#: apps/RUG_template/templates/menu.html:4 +msgid "Section" +msgstr "" + +#: apps/RUG_template/templates/menu.html:9 +msgid "Menu item" +msgstr "" + +#: apps/RUG_template/templates/pager.html:13 +msgid "previous" +msgstr "" + +#: apps/RUG_template/templates/pager.html:21 +msgid "next" +msgstr "" + +#: apps/RUG_template/templates/registration/login.html:4 +#: apps/RUG_template/templates/registration/login.html:5 +#: apps/RUG_template/templates/registration/login.html:8 +msgid "Login" +msgstr "" + +#: apps/RUG_template/templates/registration/login.html:23 +msgid "Lost password?" +msgstr "" + +#: apps/RUG_template/templates/registration/password_reset_complete.html:4 +#: apps/RUG_template/templates/registration/password_reset_complete.html:5 +#: apps/RUG_template/templates/registration/password_reset_complete.html:8 +msgid "Password reset complete" +msgstr "" + +#: apps/RUG_template/templates/registration/password_reset_confirm.html:4 +#: apps/RUG_template/templates/registration/password_reset_confirm.html:5 +#: apps/RUG_template/templates/registration/password_reset_confirm.html:8 +msgid "Set a new password!" +msgstr "" + +#: apps/RUG_template/templates/registration/password_reset_confirm.html:24 +msgid "" +"The password reset link was invalid, possibly because it has already been " +"used. Please request a new password reset." +msgstr "" + +#: apps/RUG_template/templates/registration/password_reset_done.html:4 +#: apps/RUG_template/templates/registration/password_reset_done.html:5 +#: apps/RUG_template/templates/registration/password_reset_done.html:8 +msgid "Reset password, email sent" +msgstr "" + +#: apps/RUG_template/templates/registration/password_reset_form.html:4 +#: apps/RUG_template/templates/registration/password_reset_form.html:5 +#: apps/RUG_template/templates/registration/password_reset_form.html:8 +msgid "Reset password" +msgstr "" + +#: apps/employee/apps.py:7 +msgid "Employee" +msgstr "" + +#: apps/employee/apps.py:8 +msgid "Employees" +msgstr "" + +#: apps/employee/models.py:11 +msgid "Django user" +msgstr "" + +#: apps/employee/models.py:13 +msgid "Select the hospital for this employee" +msgstr "" + +#: apps/employee/models.py:15 +msgid "Select the polyclinic(s) for this employee" +msgstr "" + +#: apps/employee/models.py:16 apps/hospital/models.py:12 +#: apps/polyclinic/models.py:11 +msgid "Phone number" +msgstr "" + +#: apps/employee/models.py:16 +msgid "The direct phone number of this employee" +msgstr "" + +#: apps/hospital/apps.py:7 +msgid "Hospital" +msgstr "" + +#: apps/hospital/apps.py:8 +msgid "Hospitals" +msgstr "" + +#: apps/hospital/models.py:8 apps/polyclinic/models.py:10 +#: apps/schedule/models.py:14 +#: apps/schedule/templates/schedule/schedule_list.html:12 +msgid "Name" +msgstr "" + +#: apps/hospital/models.py:8 +msgid "The name of this hospital" +msgstr "" + +#: apps/hospital/models.py:9 +msgid "Address" +msgstr "" + +#: apps/hospital/models.py:9 +msgid "The address of this hospital" +msgstr "" + +#: apps/hospital/models.py:10 +msgid "Postal code" +msgstr "" + +#: apps/hospital/models.py:10 +msgid "The postal code of this hospital" +msgstr "" + +#: apps/hospital/models.py:11 +msgid "City" +msgstr "" + +#: apps/hospital/models.py:11 +msgid "The city of this hospital" +msgstr "" + +#: apps/hospital/models.py:12 +msgid "The general phone number of this hospital" +msgstr "" + +#: apps/polyclinic/apps.py:7 +msgid "Polyclinic" +msgstr "" + +#: apps/polyclinic/apps.py:8 +msgid "Polyclinics" +msgstr "" + +#: apps/polyclinic/models.py:9 +msgid "To which hospital belongs this polyclinic" +msgstr "" + +#: apps/polyclinic/models.py:10 +msgid "The name of this polyclinic" +msgstr "" + +#: apps/polyclinic/models.py:11 +msgid "The general/direct phone number of this polyclinic" +msgstr "" + +#: apps/schedule/apps.py:7 +msgid "Schedule" +msgstr "" + +#: apps/schedule/apps.py:8 templates/menu.html:9 +msgid "Schedules" +msgstr "" + +#: apps/schedule/models.py:12 +msgid "Select the employee that is responsible for this schedule request" +msgstr "" + +#: apps/schedule/models.py:14 +msgid "Name of the schedule" +msgstr "" + +#: apps/schedule/models.py:15 +msgid "Email address" +msgstr "" + +#: apps/schedule/models.py:15 +msgid "Email address where the results will be sent to." +msgstr "" + +#: apps/schedule/models.py:17 +msgid "Schedule input" +msgstr "" + +#: apps/schedule/models.py:17 +msgid "The schedule input in JSON format based on the form data" +msgstr "" + +#: apps/schedule/models.py:18 +msgid "Peregrine input" +msgstr "" + +#: apps/schedule/models.py:18 +msgid "" +"This is the translated content from the source for use with Peregrine cluster" +msgstr "" + +#: apps/schedule/models.py:20 +msgid "Peregrine accepted" +msgstr "" + +#: apps/schedule/models.py:20 +msgid "When true, the Peregrine cluster has picked up the job." +msgstr "" + +#: apps/schedule/models.py:22 +msgid "Peregrine binary output" +msgstr "" + +#: apps/schedule/models.py:22 +msgid "This is the output in binary format from the Peregrine cluster" +msgstr "" + +#: apps/schedule/templates/schedule/schedule_list.html:4 +#: apps/schedule/templates/schedule/schedule_list.html:5 +#: apps/schedule/templates/schedule/schedule_list.html:8 +msgid "Schedules overview list" +msgstr "" + +#: apps/schedule/templates/schedule/schedule_list.html:11 +msgid "Department" +msgstr "" + +#: apps/schedule/templates/schedule/schedule_list.html:13 +msgid "Created" +msgstr "" + +#: apps/schedule/templates/schedule/schedule_list.html:14 +msgid "Updated" +msgstr "" + +#: apps/schedule/templates/schedule/schedule_list.html:15 +msgid "Running" +msgstr "" + +#: apps/schedule/templates/schedule/schedule_list.html:16 +msgid "Report" +msgstr "" + +#: apps/schedule/templates/schedule/schedule_list.html:29 +msgid "No schedules available" +msgstr "" + +#: lib/models/base.py:16 +msgid "Date created" +msgstr "" + +#: lib/models/base.py:16 +msgid "The date and time this model has been created" +msgstr "" + +#: lib/models/base.py:17 +msgid "Date updated" +msgstr "" + +#: lib/models/base.py:17 +msgid "The date and time this model has been updated" +msgstr "" + +#: polyclinic_scheduling/settings.py:129 +msgid "Dutch" +msgstr "" + +#: polyclinic_scheduling/settings.py:130 +msgid "English" +msgstr "" + +#: templates/menu.html:4 +msgid "Menu" +msgstr "" + +#: templates/menu.html:13 +msgid "New schedule" +msgstr "" + +#: templates/menu.html:18 +msgid "Logout" +msgstr "" diff --git a/polyclinic_scheduling/locale/nl/LC_MESSAGES/django.po b/polyclinic_scheduling/locale/nl/LC_MESSAGES/django.po new file mode 100644 index 0000000..e04074f --- /dev/null +++ b/polyclinic_scheduling/locale/nl/LC_MESSAGES/django.po @@ -0,0 +1,318 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-05-13 08:34+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: apps/RUG_template/apps.py:7 apps/RUG_template/apps.py:8 +msgid "RUG_template" +msgstr "" + +#: apps/RUG_template/templates/base.html:7 +msgid "Welcome at RUG Data drop" +msgstr "" + +#: apps/RUG_template/templates/base.html:84 +msgid "Language selection" +msgstr "" + +#: apps/RUG_template/templates/index.html:4 +#: apps/RUG_template/templates/index.html:5 +msgid "Welcome to the RUG Template page" +msgstr "" + +#: apps/RUG_template/templates/index.html:8 +msgid "Simple RUG Template" +msgstr "" + +#: apps/RUG_template/templates/index.html:10 +msgid "Some more text" +msgstr "" + +#: apps/RUG_template/templates/menu.html:4 +msgid "Section" +msgstr "" + +#: apps/RUG_template/templates/menu.html:9 +msgid "Menu item" +msgstr "" + +#: apps/RUG_template/templates/pager.html:13 +msgid "previous" +msgstr "" + +#: apps/RUG_template/templates/pager.html:21 +msgid "next" +msgstr "" + +#: apps/RUG_template/templates/registration/login.html:4 +#: apps/RUG_template/templates/registration/login.html:5 +#: apps/RUG_template/templates/registration/login.html:8 +msgid "Login" +msgstr "" + +#: apps/RUG_template/templates/registration/login.html:23 +msgid "Lost password?" +msgstr "" + +#: apps/RUG_template/templates/registration/password_reset_complete.html:4 +#: apps/RUG_template/templates/registration/password_reset_complete.html:5 +#: apps/RUG_template/templates/registration/password_reset_complete.html:8 +msgid "Password reset complete" +msgstr "" + +#: apps/RUG_template/templates/registration/password_reset_confirm.html:4 +#: apps/RUG_template/templates/registration/password_reset_confirm.html:5 +#: apps/RUG_template/templates/registration/password_reset_confirm.html:8 +msgid "Set a new password!" +msgstr "" + +#: apps/RUG_template/templates/registration/password_reset_confirm.html:24 +msgid "" +"The password reset link was invalid, possibly because it has already been " +"used. Please request a new password reset." +msgstr "" + +#: apps/RUG_template/templates/registration/password_reset_done.html:4 +#: apps/RUG_template/templates/registration/password_reset_done.html:5 +#: apps/RUG_template/templates/registration/password_reset_done.html:8 +msgid "Reset password, email sent" +msgstr "" + +#: apps/RUG_template/templates/registration/password_reset_form.html:4 +#: apps/RUG_template/templates/registration/password_reset_form.html:5 +#: apps/RUG_template/templates/registration/password_reset_form.html:8 +msgid "Reset password" +msgstr "" + +#: apps/employee/apps.py:7 +msgid "Employee" +msgstr "" + +#: apps/employee/apps.py:8 +msgid "Employees" +msgstr "" + +#: apps/employee/models.py:11 +msgid "Django user" +msgstr "" + +#: apps/employee/models.py:13 +msgid "Select the hospital for this employee" +msgstr "" + +#: apps/employee/models.py:15 +msgid "Select the polyclinic(s) for this employee" +msgstr "" + +#: apps/employee/models.py:16 apps/hospital/models.py:12 +#: apps/polyclinic/models.py:11 +msgid "Phone number" +msgstr "" + +#: apps/employee/models.py:16 +msgid "The direct phone number of this employee" +msgstr "" + +#: apps/hospital/apps.py:7 +msgid "Hospital" +msgstr "" + +#: apps/hospital/apps.py:8 +msgid "Hospitals" +msgstr "" + +#: apps/hospital/models.py:8 apps/polyclinic/models.py:10 +#: apps/schedule/models.py:14 +#: apps/schedule/templates/schedule/schedule_list.html:12 +msgid "Name" +msgstr "" + +#: apps/hospital/models.py:8 +msgid "The name of this hospital" +msgstr "" + +#: apps/hospital/models.py:9 +msgid "Address" +msgstr "" + +#: apps/hospital/models.py:9 +msgid "The address of this hospital" +msgstr "" + +#: apps/hospital/models.py:10 +msgid "Postal code" +msgstr "" + +#: apps/hospital/models.py:10 +msgid "The postal code of this hospital" +msgstr "" + +#: apps/hospital/models.py:11 +msgid "City" +msgstr "" + +#: apps/hospital/models.py:11 +msgid "The city of this hospital" +msgstr "" + +#: apps/hospital/models.py:12 +msgid "The general phone number of this hospital" +msgstr "" + +#: apps/polyclinic/apps.py:7 +msgid "Polyclinic" +msgstr "" + +#: apps/polyclinic/apps.py:8 +msgid "Polyclinics" +msgstr "" + +#: apps/polyclinic/models.py:9 +msgid "To which hospital belongs this polyclinic" +msgstr "" + +#: apps/polyclinic/models.py:10 +msgid "The name of this polyclinic" +msgstr "" + +#: apps/polyclinic/models.py:11 +msgid "The general/direct phone number of this polyclinic" +msgstr "" + +#: apps/schedule/apps.py:7 +msgid "Schedule" +msgstr "" + +#: apps/schedule/apps.py:8 templates/menu.html:9 +msgid "Schedules" +msgstr "" + +#: apps/schedule/models.py:12 +msgid "Select the employee that is responsible for this schedule request" +msgstr "" + +#: apps/schedule/models.py:14 +msgid "Name of the schedule" +msgstr "" + +#: apps/schedule/models.py:15 +msgid "Email address" +msgstr "" + +#: apps/schedule/models.py:15 +msgid "Email address where the results will be sent to." +msgstr "" + +#: apps/schedule/models.py:17 +msgid "Schedule input" +msgstr "" + +#: apps/schedule/models.py:17 +msgid "The schedule input in JSON format based on the form data" +msgstr "" + +#: apps/schedule/models.py:18 +msgid "Peregrine input" +msgstr "" + +#: apps/schedule/models.py:18 +msgid "" +"This is the translated content from the source for use with Peregrine cluster" +msgstr "" + +#: apps/schedule/models.py:20 +msgid "Peregrine accepted" +msgstr "" + +#: apps/schedule/models.py:20 +msgid "When true, the Peregrine cluster has picked up the job." +msgstr "" + +#: apps/schedule/models.py:22 +msgid "Peregrine binary output" +msgstr "" + +#: apps/schedule/models.py:22 +msgid "This is the output in binary format from the Peregrine cluster" +msgstr "" + +#: apps/schedule/templates/schedule/schedule_list.html:4 +#: apps/schedule/templates/schedule/schedule_list.html:5 +#: apps/schedule/templates/schedule/schedule_list.html:8 +msgid "Schedules overview list" +msgstr "" + +#: apps/schedule/templates/schedule/schedule_list.html:11 +msgid "Department" +msgstr "" + +#: apps/schedule/templates/schedule/schedule_list.html:13 +msgid "Created" +msgstr "" + +#: apps/schedule/templates/schedule/schedule_list.html:14 +msgid "Updated" +msgstr "" + +#: apps/schedule/templates/schedule/schedule_list.html:15 +msgid "Running" +msgstr "" + +#: apps/schedule/templates/schedule/schedule_list.html:16 +msgid "Report" +msgstr "" + +#: apps/schedule/templates/schedule/schedule_list.html:29 +msgid "No schedules available" +msgstr "" + +#: lib/models/base.py:16 +msgid "Date created" +msgstr "" + +#: lib/models/base.py:16 +msgid "The date and time this model has been created" +msgstr "" + +#: lib/models/base.py:17 +msgid "Date updated" +msgstr "" + +#: lib/models/base.py:17 +msgid "The date and time this model has been updated" +msgstr "" + +#: polyclinic_scheduling/settings.py:129 +msgid "Dutch" +msgstr "" + +#: polyclinic_scheduling/settings.py:130 +msgid "English" +msgstr "" + +#: templates/menu.html:4 +msgid "Menu" +msgstr "" + +#: templates/menu.html:13 +msgid "New schedule" +msgstr "" + +#: templates/menu.html:18 +msgid "Logout" +msgstr "" diff --git a/polyclinic_scheduling/manage.py b/polyclinic_scheduling/manage.py new file mode 100755 index 0000000..7bf2275 --- /dev/null +++ b/polyclinic_scheduling/manage.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python +"""Django's command-line utility for administrative tasks.""" +import os +import sys + + +def main(): + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'polyclinic_scheduling.settings') + try: + from django.core.management import execute_from_command_line + except ImportError as exc: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) from exc + execute_from_command_line(sys.argv) + + +if __name__ == '__main__': + main() diff --git a/polyclinic_scheduling/polyclinic_scheduling/.env.example b/polyclinic_scheduling/polyclinic_scheduling/.env.example new file mode 100644 index 0000000..77e285b --- /dev/null +++ b/polyclinic_scheduling/polyclinic_scheduling/.env.example @@ -0,0 +1,38 @@ +# A uniquely secret key +SECRET_KEY=@wb=#(f4uc0l%e!5*eo+aoflnxb(@!l9!=c5w=4b+x$=!8&vy%' + +# Disable debug in production +DEBUG=False + +# Allowed hosts that Django does server. Take care when NGINX is proxying infront of Django +ALLOWED_HOSTS=127.0.0.1,localhost + +# All internal IPS for Django. Use comma separated list +INTERNAL_IPS=127.0.0.1 + +# Enter the database url connection: https://github.com/jacobian/dj-database-url +DATABASE_URL=sqlite:////opt/deploy/VRE/VirtualResearchEnvironment/db.sqlite3 + +# The location on disk where the static files will be placed during deployment. Setting is required +STATIC_ROOT = + +# Email settings + +# Mail host +EMAIL_HOST= + +# Email user name +EMAIL_HOST_USER= + +# Email password +EMAIL_HOST_PASSWORD= + +# Email server port number to use +EMAIL_PORT=25 + +# Does the email server supports TLS? +EMAIL_USE_TLS= + +# The sender address. This needs to be one of the allowed domains due to SPF checks +# The code will use a reply-to header to make sure that replies goes to the researcher and not this address +EMAIL_FROM_ADDRESS=Do not reply \ No newline at end of file diff --git a/polyclinic_scheduling/polyclinic_scheduling/__init__.py b/polyclinic_scheduling/polyclinic_scheduling/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/polyclinic_scheduling/polyclinic_scheduling/asgi.py b/polyclinic_scheduling/polyclinic_scheduling/asgi.py new file mode 100644 index 0000000..276efe1 --- /dev/null +++ b/polyclinic_scheduling/polyclinic_scheduling/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for polyclinic_scheduling project. + +It exposes the ASGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'polyclinic_scheduling.settings') + +application = get_asgi_application() diff --git a/polyclinic_scheduling/polyclinic_scheduling/settings.py b/polyclinic_scheduling/polyclinic_scheduling/settings.py new file mode 100644 index 0000000..b517a76 --- /dev/null +++ b/polyclinic_scheduling/polyclinic_scheduling/settings.py @@ -0,0 +1,162 @@ +""" +Django settings for polyclinic_scheduling project. + +Generated by 'django-admin startproject' using Django 3.0.6. + +For more information on this file, see +https://docs.djangoproject.com/en/3.0/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/3.0/ref/settings/ +""" + +import os +from decouple import config, Csv +from dj_database_url import parse as db_url +from django.utils.translation import ugettext_lazy as _ + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = config('SECRET_KEY') + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = config('DEBUG', default=False, cast=bool) + +ALLOWED_HOSTS = config('ALLOWED_HOSTS', default='127.0.0.1', cast=Csv()) + +INTERNAL_IPS = config('INTERNAL_IPS',default='127.0.0.1',cast=Csv()) + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + + 'apps.hospital', + 'apps.polyclinic', + 'apps.employee', + 'apps.schedule', + + 'apps.RUG_template', + + 'django.contrib.admin', # Admin add here, so that we can overrule the password reset template +] + +if DEBUG: + INSTALLED_APPS.append('debug_toolbar') + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', + 'django.middleware.locale.LocaleMiddleware', +] + +if DEBUG: + MIDDLEWARE.append('debug_toolbar.middleware.DebugToolbarMiddleware') + +ROOT_URLCONF = 'polyclinic_scheduling.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [os.path.join(BASE_DIR, 'templates'),], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'polyclinic_scheduling.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/3.0/ref/settings/#databases + +DATABASES = { + 'default': config( + 'DATABASE_URL', + default='sqlite:///' + os.path.join(BASE_DIR, 'db.sqlite3'), + cast=db_url + ) +} + +# Password validation +# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + +LOGIN_REDIRECT_URL = '/' +LOGOUT_REDIRECT_URL = '/' + +# Internationalization +# https://docs.djangoproject.com/en/3.0/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +LANGUAGES = [ + ('nl', _('Dutch')), + ('en', _('English')), +] + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/3.0/howto/static-files/ + +STATIC_URL = '/static/' + +STATICFILES_DIRS = [ + os.path.join(BASE_DIR, "static"), +] + +STATIC_ROOT = config('STATIC_ROOT',None) + +EMAIL_FROM_ADDRESS = config('EMAIL_FROM_ADDRESS', default='Do not reply') +EMAIL_HOST = config('EMAIL_HOST', default='') +EMAIL_HOST_USER = config('EMAIL_HOST_USER', default='') +EMAIL_HOST_PASSWORD = config('EMAIL_HOST_PASSWORD', default='') +EMAIL_PORT = config('EMAIL_PORT', default=25, cast=int) +EMAIL_USE_TLS = config('EMAIL_USE_TLS', default=False, cast=bool) + +if DEBUG: + EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend' + EMAIL_FILE_PATH = os.path.join(BASE_DIR, 'sent_emails') \ No newline at end of file diff --git a/polyclinic_scheduling/polyclinic_scheduling/urls.py b/polyclinic_scheduling/polyclinic_scheduling/urls.py new file mode 100644 index 0000000..64a1811 --- /dev/null +++ b/polyclinic_scheduling/polyclinic_scheduling/urls.py @@ -0,0 +1,34 @@ +"""polyclinic_scheduling URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/3.0/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: path('', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.urls import include, path + 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) +""" +from django.conf import settings +from django.contrib import admin +from django.urls import include, path +from django.conf.urls.static import static + +urlpatterns = [ + path('admin/', admin.site.urls), + path('i18n/', include('django.conf.urls.i18n')), + path('accounts/', include('django.contrib.auth.urls')), + + path('', include('apps.RUG_template.urls')), + path('schedule/', include('apps.schedule.urls')), +] + +if settings.DEBUG: + import debug_toolbar + urlpatterns = [ + path('__debug__/', include(debug_toolbar.urls)), + ] + urlpatterns + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) \ No newline at end of file diff --git a/polyclinic_scheduling/polyclinic_scheduling/wsgi.py b/polyclinic_scheduling/polyclinic_scheduling/wsgi.py new file mode 100644 index 0000000..56efd2a --- /dev/null +++ b/polyclinic_scheduling/polyclinic_scheduling/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for polyclinic_scheduling project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'polyclinic_scheduling.settings') + +application = get_wsgi_application() diff --git a/polyclinic_scheduling/templates/menu.html b/polyclinic_scheduling/templates/menu.html new file mode 100644 index 0000000..8c6ebd1 --- /dev/null +++ b/polyclinic_scheduling/templates/menu.html @@ -0,0 +1,23 @@ +{% load i18n %} + +
  • +{% trans "Menu" %} + + +
  • diff --git a/polyclinic_scheduling/templates/singup.html b/polyclinic_scheduling/templates/singup.html new file mode 100644 index 0000000..bffcda8 --- /dev/null +++ b/polyclinic_scheduling/templates/singup.html @@ -0,0 +1,13 @@ +{% extends 'base.html' %} +{% load i18n %} + +{% block title %}{% trans "Singup" %}{% endblock %} +{% block pagetitle %}{% trans "Singup" %}{% endblock %} +{% block content %} +

    +{% trans "Singup" %} +
    +Please contact x@y.z +

    + +{% endblock %} \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..227a756 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +Django==3.0.6 +jsonfield==3.1.0 +python-decouple==3.3 +dj-database-url==0.5.0 \ No newline at end of file