+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{% if messages %}
+ {% for message in messages %}
+
+ {% endfor %}
+{% endif %}
+
+
+
+
+
+
+{% block content %} -=PageContent=- {% endblock %}
+
+
+
+
+
+print
+
+
+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 %} + + +
+ ++{% 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 "Login" %} +
+ + + +{# Assumes you setup the password_reset view in your URLconf #} + +{% 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 %} +
+{% 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!
+
+{% trans "Reset password" %} +
+ + + + +{% 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" %} +
+ + +{% 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" %} +
{% trans "Department" %} | {% endcomment %} +{% trans "Name" %} | +{% trans "Created" %} | +{% trans "Updated" %} | +{% trans "Running" %} | +{% trans "Report" %} | +
---|---|---|---|---|---|
{{ schedule.name }} | {% endcomment %} +{% comment %}{% endcomment %}{{ schedule.name }}{% comment %}{% endcomment %} | +{{ schedule.created_at|date:"SHORT_DATETIME_FORMAT" }} | +{{ schedule.updated_at|date:"SHORT_DATETIME_FORMAT" }} | +None | +None | +
{% trans "No schedules available" %} | +