Update schedule module

This commit is contained in:
Joshua Rubingh 2020-05-14 15:20:19 +02:00
parent 5be8fa9c6d
commit d9899f2d56
17 changed files with 871 additions and 701 deletions

View File

@ -21,4 +21,48 @@
.rug-breadcrumbs {
display: none;
}
p {
max-width: none;
}
table {
width: 100%;
}
input {
width: 100%
}
.alert-warning {
color: #856404;
background-color: #fff3cd;
border-color: #ffeeba;
}
.alert-success {
color: #155724;
background-color: #d4edda;
border-color: #c3e6cb;
}
.alert-danger {
color: #721c24;
background-color: #f8d7da;
border-color: #f5c6cb;
}
.form-control {
display: block;
width: 100%;
height: calc(1.5em + .75rem + 2px);
padding: .375rem .75rem;
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
color: #495057;
background-color: #fff;
background-clip: padding-box;
border: 1px solid #ced4da;
border-radius: .25rem;
transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
}

View File

@ -4,8 +4,6 @@
{% block title %}{% trans "Welcome to the RUG Template page" %}{% endblock %}
{% block pagetitle %}{% trans "Welcome to the RUG Template page" %}{% endblock %}
{% block content %}
<p>
<strong>{% trans "Simple RUG Template" %}</strong>
</p>
<p><strong>{% trans "Simple RUG Template" %}</strong></p>
<p>{% trans "Some more text" %}</p>
{% endblock %}

View File

@ -1,13 +1,10 @@
{% load i18n %}
<li class="rug-nav--secondary__item">
<a class="rug-nav--secondary__link js--togglable-switch" data-toggle-class="rug-nav--secondary__link--selected" data-toggle-group="submenu" data-toggle-id="menu-2427370b-9435-44d9-bca7-b93ec9d03cc0-33.31" data-toggle-mode="togglable">{% trans "Section" %}</a>
<ul class="rug-nav--secondary__sub rug-nav--secondary__sub--hidden js--togglable-item" data-toggle-class="rug-block" data-toggle-group="submenu" data-toggle-id="menu-2427370b-9435-44d9-bca7-b93ec9d03cc0-33.31">
<li class="rug-nav--secondary__sub__item" data-menu-id="b512aa55-f0cb-4588-9054-302caa5fa951-33.34">
<a class="rug-nav--secondary__sub__link" href="#"><span class="rug-nav--secondary__sub__link-text">{% trans "Menu item" %}</span></a>
</li>
</ul>
<a class="rug-nav--secondary__link js--togglable-switch" data-toggle-class="rug-nav--secondary__link--selected" data-toggle-group="submenu" data-toggle-id="menu-2427370b-9435-44d9-bca7-b93ec9d03cc0-33.31" data-toggle-mode="togglable">{% trans "Section" %}</a>
<ul class="rug-nav--secondary__sub rug-nav--secondary__sub--hidden js--togglable-item" data-toggle-class="rug-block" data-toggle-group="submenu" data-toggle-id="menu-2427370b-9435-44d9-bca7-b93ec9d03cc0-33.31">
<li class="rug-nav--secondary__sub__item" data-menu-id="b512aa55-f0cb-4588-9054-302caa5fa951-33.34">
<a class="rug-nav--secondary__sub__link" href="#"><span class="rug-nav--secondary__sub__link-text">{% trans "Menu item" %}</span></a>
</li>
</ul>
</li>

View File

@ -5,9 +5,12 @@
{% block pagetitle %}{% trans "Login" %}{% endblock %}
{% block content %}
<p>
<strong>{% trans "Login" %}</strong>
<strong>{% trans "Login" %}</strong>
<br />
{% blocktrans %}
You can login here to create your schedules. If you do not have a login, please contact: some_one@rug.nl
{% endblocktrans %}
</p>
<form method="post" action="{% url 'login' %}">
{% csrf_token %}
<input type="hidden" name="next" value="{{ next }}">
@ -18,7 +21,7 @@
</tr>
</table>
</form>
<br />
{# Assumes you setup the password_reset view in your URLconf #}
<p><a href="{% url 'password_reset' %}">{% trans "Lost password?" %}</a></p>
{% endblock %}

View File

@ -4,9 +4,7 @@
{% block title %}{% trans "Password reset complete" %}{% endblock %}
{% block pagetitle %}{% trans "Password reset complete" %}{% endblock %}
{% block content %}
<p>
<strong>{% trans "Password reset complete" %}</strong>
<br />
<p>Your new password has been set. You can log in now on the <a href="{% url 'login' %}">log in page</a>.</p>
</p>
<p><strong>{% trans "Password reset complete" %}</strong></p>
{% url 'login' as login_url %}
<p>{% blocktrans %}Your new password has been set. You can log in now on the <a href="{{ login_url }}">log in page</a>.{% endblocktrans %}</p>
{% endblock %}

View File

@ -4,22 +4,23 @@
{% block title %}{% trans "Set a new password!" %}{% endblock %}
{% block pagetitle %}{% trans "Set a new password!" %}{% endblock %}
{% block content %}
<p>
<strong>{% trans "Set a new password!" %}</strong>
<p><strong>{% trans "Set a new password!" %}</strong><br />
{% if validlink %}
<form method="POST">
<table>
{% csrf_token %}
{{ form.as_table }}
<tr>
<td>
<input type="submit" value="Change my password">
</td>
</tr>
</table>
</form>
{% blocktrans %}Here you can set a new password.{% endblocktrans %}
</p>
<form method="POST">
<table>
{% csrf_token %}
{{ form.as_table }}
<tr>
<td colspan="2">
<input type="submit" value="{% trans "Change my password" %}">
</td>
</tr>
</table>
</form>
{% else %}
<p>{% trans "The password reset link was invalid, possibly because it has already been used. Please request a new password reset." %}</p>
{% trans "The password reset link was invalid, possibly because it has already been used. Please request a new password reset." %}</p>
{% endif %}
</p>
{% endblock %}

View File

@ -8,6 +8,6 @@
<strong>{% trans "Reset password, email sent" %}</strong>
<br />
<br />
We've emailed you instructions for setting your password. You should receive the email shortly!
{% blocktrans %}We've emailed you instructions for setting your password. You should receive the email shortly!{% endblocktrans %}
</p>
{% endblock %}

File diff suppressed because one or more lines are too long

View File

@ -6,19 +6,16 @@
{% block content %}
<p>
<strong>{% trans "Reset password" %}</strong>
<br />
{% blocktrans %}Here you can request a password reset. Please enter your email address that is used for registration.{% endblocktrans %}
</p>
<form method="post" action="{% url 'password_reset' %}">
{% csrf_token %}
<table>
<tr>
<td>{{ form.email.label_tag }}</td>
<td>{{ form.email }}</td>
</tr>
</table>
<input type="submit" value="Reset my password">
{% csrf_token %}
<table>
{{ form.as_table }}
<tr>
<td colspan="2"><input type="submit" value="{% trans "Reset my password"%} "></td>
</tr>
</table>
</form>
{% endblock %}
{% endblock %}

View File

@ -4,9 +4,7 @@
{% block title %}{% trans "Singup" %}{% endblock %}
{% block pagetitle %}{% trans "Singup" %}{% endblock %}
{% block content %}
<p>
<strong>{% trans "Singup" %}</strong>
</p>
<p><strong>{% trans "Singup" %}</strong></p>
<form method="post" action="{% url 'signup' %}">
{% csrf_token %}

View File

@ -0,0 +1,24 @@
from django.core.management.base import BaseCommand, CommandError
from apps.schedule.models import Schedule
#from polls.models import Question as Poll
class Command(BaseCommand):
help = 'Send out all the new reports'
# def add_arguments(self, parser):
# parser.add_argument('poll_ids', nargs='+', type=int)
def handle(self, *args, **options):
Schedule.objects.filter(peregrine_result__isnull=False).filter(report_sent__isnull=True)
# for poll_id in options['poll_ids']:
# try:
# poll = Poll.objects.get(pk=poll_id)
# except Poll.DoesNotExist:
# raise CommandError('Poll "%s" does not exist' % poll_id)
# poll.opened = False
# poll.save()
# self.stdout.write(self.style.SUCCESS('Successfully closed poll "%s"' % poll_id))

View File

@ -0,0 +1,25 @@
# Generated by Django 3.0.6 on 2020-05-14 13:18
import collections
from django.db import migrations, models
import jsonfield.fields
class Migration(migrations.Migration):
dependencies = [
('schedule', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='schedule',
name='peregrine_result',
field=jsonfield.fields.JSONField(blank=True, help_text='The results from the Peregrine job in JSON', load_kwargs={'object_pairs_hook': collections.OrderedDict}, verbose_name='Peregrine JSON output'),
),
migrations.AddField(
model_name='schedule',
name='report_sent',
field=models.DateTimeField(blank=True, help_text='The date and time when the report has sended to the user.', null=True, verbose_name='Report is send to user'),
),
]

View File

@ -15,12 +15,17 @@ class Schedule(MetaDataModel):
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.'))
peregrine_result = JSONField(_('Peregrine JSON output'), blank=True, load_kwargs={'object_pairs_hook': collections.OrderedDict}, help_text=_('The results from the Peregrine job in JSON'))
output_peregrine = models.BinaryField(_('Peregrine binary output'), blank=True, help_text=_('This is the output in binary format from the Peregrine cluster'))
report_sent = models.DateTimeField(_('Report is send to user'), blank=True, null=True, help_text=_('The date and time when the report has sended to the user.'))
def __str__(self):
"""str: Returns a readable name for the schedule. Format is [schedule_name] (employee_name)."""
return '{} ({})'.format(self.name, self.employee)

View File

@ -159,4 +159,6 @@ 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')
EMAIL_FILE_PATH = os.path.join(BASE_DIR, 'sent_emails')
REPORTS_OUTPUT = os.path.join(BASE_DIR, 'reports')

View File

@ -1,23 +1,18 @@
{% load i18n %}
<li class="rug-nav--secondary__item">
<a class="rug-nav--secondary__link js--togglable-switch" data-toggle-class="rug-nav--secondary__link--selected" data-toggle-group="submenu" data-toggle-id="menu-2427370b-9435-44d9-bca7-b93ec9d03cc0-33.31" data-toggle-mode="togglable">{% trans "Menu" %}</a>
<ul class="rug-nav--secondary__sub rug-nav--secondary__sub--hidden js--togglable-item" data-toggle-class="rug-block" data-toggle-group="submenu" data-toggle-id="menu-2427370b-9435-44d9-bca7-b93ec9d03cc0-33.31">
<li class="rug-nav--secondary__sub__item" data-menu-id="b512aa55-f0cb-4588-9054-302caa5fa951-33.34">
<a class="rug-nav--secondary__sub__link" href="{% url 'schedule:list' %}"><span class="rug-nav--secondary__sub__link-text">{% trans "Schedules" %}</span></a>
</li>
<li class="rug-nav--secondary__sub__item" data-menu-id="b512aa55-f0cb-4588-9054-302caa5fa951-33.35">
<a class="rug-nav--secondary__sub__link" href="{% url 'schedule:new' %}"><span class="rug-nav--secondary__sub__link-text">{% trans "New schedule" %}</span></a>
</li>
<li class="rug-nav--secondary__sub__item" data-menu-id="b512aa55-f0cb-4588-9054-302caa5fa951-33.36">
<a class="rug-nav--secondary__sub__link" href="{% url 'logout' %}"><span class="rug-nav--secondary__sub__link-text">{% trans "Logout" %}</span></a>
</li>
</ul>
<a class="rug-nav--secondary__link js--togglable-switch" data-toggle-class="rug-nav--secondary__link--selected" data-toggle-group="submenu" data-toggle-id="menu-2427370b-9435-44d9-bca7-b93ec9d03cc0-33.31" data-toggle-mode="togglable">{% trans "Menu" %}</a>
<ul class="rug-nav--secondary__sub rug-nav--secondary__sub--hidden js--togglable-item" data-toggle-class="rug-block" data-toggle-group="submenu" data-toggle-id="menu-2427370b-9435-44d9-bca7-b93ec9d03cc0-33.31">
<li class="rug-nav--secondary__sub__item" data-menu-id="b512aa55-f0cb-4588-9054-302caa5fa951-33.34">
<a class="rug-nav--secondary__sub__link" href="{% url 'schedule:list' %}"><span class="rug-nav--secondary__sub__link-text">{% trans "Schedules" %}</span></a>
</li>
<li class="rug-nav--secondary__sub__item" data-menu-id="b512aa55-f0cb-4588-9054-302caa5fa951-33.35">
<a class="rug-nav--secondary__sub__link" href="{% url 'schedule:new' %}"><span class="rug-nav--secondary__sub__link-text">{% trans "New schedule" %}</span></a>
</li>
{% if user.is_authenticated %}
<li class="rug-nav--secondary__sub__item" data-menu-id="b512aa55-f0cb-4588-9054-302caa5fa951-33.36">
<a class="rug-nav--secondary__sub__link" href="{% url 'logout' %}"><span class="rug-nav--secondary__sub__link-text">{% trans "Logout" %}</span></a>
</li>
{% endif %}
</ul>
</li>

View File

@ -1,13 +1,12 @@
{% extends 'base.html' %} <!-- Add this for inheritance -->
{% load i18n %}
{% block title %}{% trans "Singup" %}{% endblock %}
{% block pagetitle %}{% trans "Singup" %}{% endblock %}
{% block title %}{% trans "Signup" %}{% endblock %}
{% block pagetitle %}{% trans "Signup" %}{% endblock %}
{% block content %}
<p>
<strong>{% trans "Singup" %}</strong>
<strong>{% trans "Signup" %}</strong>
<br />
Please contact x@y.z
{% blocktrans %}Please contact x@y.z{% endblocktrans %}
</p>
{% endblock %}