Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Alsijil
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-App-Alsijil
Commits
4382d174
Verified
Commit
4382d174
authored
5 years ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Patches
Plain Diff
Raise proper 404 error if no lesson is found.
parent
1325e534
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
biscuit/apps/alsijil/templates/alsijil/lesson.html
+35
-51
35 additions, 51 deletions
biscuit/apps/alsijil/templates/alsijil/lesson.html
biscuit/apps/alsijil/views.py
+3
-3
3 additions, 3 deletions
biscuit/apps/alsijil/views.py
with
38 additions
and
54 deletions
biscuit/apps/alsijil/templates/alsijil/lesson.html
+
35
−
51
View file @
4382d174
...
...
@@ -24,63 +24,47 @@
{% endblock %}
{% block content %}
{% if lesson_period %}
<form
method=
"post"
>
{% csrf_token %}
<form
method=
"post"
>
{% csrf_token %}
<div
class=
"card"
>
<div
class=
"card-header bg-light text-dark"
>
{% blocktrans %}Lesson documentation{% endblocktrans %}
</div>
<div
class=
"card-body"
>
{% csrf_token %}
{% bootstrap_form lesson_documentation_form %}
</div>
<div
class=
"card"
>
<div
class=
"card-header bg-light text-dark"
>
{% blocktrans %}Lesson documentation{% endblocktrans %}
</div>
<div
class=
"card-body"
>
{% csrf_token %}
{% bootstrap_form lesson_documentation_form %}
</div>
</div>
<div
class=
"card"
>
<div
class=
"card-header bg-light text-dark"
>
{% blocktrans %}Personal notes{% endblocktrans %}
</div>
<div
class=
"card-body"
>
{{ personal_note_formset.management_form }}
<div
class=
"card"
>
<div
class=
"card-header bg-light text-dark"
>
{% blocktrans %}Personal notes{% endblocktrans %}
</div>
<div
class=
"card-body"
>
{{ personal_note_formset.management_form }}
<table
class=
"table table-striped table-bordered table-hover table-responsive-xl"
>
<table
class=
"table table-striped table-bordered table-hover table-responsive-xl"
>
<tr>
<th>
{% blocktrans %}Person{% endblocktrans %}
</th>
<th>
{% blocktrans %}Absent{% endblocktrans %}
</th>
<th>
{% blocktrans %}Tardiness{% endblocktrans %}
</th>
<th>
{% blocktrans %}Excused{% endblocktrans %}
</th>
<th>
{% blocktrans %}Remarks{% endblocktrans %}
</th>
</tr>
{% for form in personal_note_formset %}
{{ form.id }}
<tr>
<t
h
>
{
% blocktrans %}Person{% endblocktrans %
}
</t
h
>
<t
h
>
{
% blocktrans %}Absent{% endblocktrans %
}
</t
h
>
<t
h
>
{
% blocktrans %}Tardiness{% endblocktrans %
}
</t
h
>
<t
h
>
{
% blocktrans %}Excused{% endblocktrans %
}
</t
h
>
<t
h
>
{
% blocktrans %}Remarks{% endblocktrans %
}
</t
h
>
<t
d
>
{
{ form.person_name }
}
</t
d
>
<t
d
>
{
{ form.absent }
}
</t
d
>
<t
d
>
{
{ form.late }
}
</t
d
>
<t
d
>
{
{ form.excused }
}
</t
d
>
<t
d
>
{
{ form.remarks }
}
</t
d
>
</tr>
{% for form in personal_note_formset %}
{{ form.id }}
<tr>
<td>
{{ form.person_name }}
</td>
<td>
{{ form.absent }}
</td>
<td>
{{ form.late }}
</td>
<td>
{{ form.excused }}
</td>
<td>
{{ form.remarks }}
</td>
</tr>
{% endfor %}
</table>
</div>
</div>
<input
type=
"submit"
value=
"{% blocktrans %}Save{% endblocktrans %}"
/>
</form>
{% else %}
<div
class=
"card text-white bg-danger"
>
<div
class=
"card-header"
>
{% blocktrans %}No lesson found{% endblocktrans %}
</div>
<div
class=
"card-body"
>
<p>
{% blocktrans %}
You either selected an invalid lesson or there
is currently no lesson in progress.
{% endblocktrans %}
</p>
{% endfor %}
</table>
</div>
</div>
{% endif %}
<input
type=
"submit"
value=
"{% blocktrans %}Save{% endblocktrans %}"
/>
</form>
{% endblock %}
This diff is collapsed.
Click to expand it.
biscuit/apps/alsijil/views.py
+
3
−
3
View file @
4382d174
...
...
@@ -3,8 +3,9 @@ from typing import Optional
from
django.contrib.auth.decorators
import
login_required
from
django.db.models
import
Exists
,
OuterRef
,
Q
from
django.http
import
Http
Request
,
HttpRe
sponse
,
HttpResponse
NotFound
from
django.http
import
Http
404
,
HttpRe
quest
,
HttpResponse
from
django.shortcuts
import
render
from
django.utils.translation
import
ugettext
as
_
from
django.views.decorators.cache
import
cache_page
from
biscuit.apps.chronos.models
import
LessonPeriod
,
TimePeriod
...
...
@@ -30,8 +31,7 @@ def lesson(request: HttpRequest, week: Optional[int] = None, period_id: Optional
wanted_week
=
current_week
()
if
not
lesson_period
:
#XXX TODO: nice error page (“no lesson currently running for you?” or so)
return
HttpResponseNotFound
(
"
no current lesson found for you
"
)
raise
Http404
(
_
(
'
You either selected an invalid lesson or there is currently no lesson in progress.
'
))
context
[
'
lesson_period
'
]
=
lesson_period
context
[
'
week
'
]
=
wanted_week
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment