Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sifrovacka
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TO
sifrovacka
Commits
acb490e3
Commit
acb490e3
authored
2 years ago
by
zdenek.kubala
Committed by
jan.bednarik
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
join sifrovacka only when it is active
parent
603a9e1a
No related branches found
No related tags found
1 merge request
!8
join sifrovacka only when it is active
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
sifrovacka/templates/sifrovacka.html
+19
-13
19 additions, 13 deletions
sifrovacka/templates/sifrovacka.html
sifrovacka/views.py
+4
-1
4 additions, 1 deletion
sifrovacka/views.py
with
23 additions
and
14 deletions
sifrovacka/templates/sifrovacka.html
+
19
−
13
View file @
acb490e3
...
...
@@ -39,20 +39,26 @@
<hr>
{% if request.user.is_authenticated %}
{% if not sifrovacka_stage_count == 0 %}
{% if not sifrovacka_current_stage_urlhash %}
<form action="{% url 'home' %}" method="post">
{% csrf_token %}
<button class="btn btn--autowidth btn--hoveractive btn--to-grey-500" type="submit" value={{ sifrovacka_id }} name='signupsif'>
<div class="btn__body ">Přihlásit se k šifrovačce</div>
</button>
</form>
{% if not is_archived_sifrovacka %}
{% if not sifrovacka_current_stage_urlhash %}
<form action="{% url 'home' %}" method="post">
{% csrf_token %}
<button class="btn btn--autowidth btn--hoveractive btn--to-grey-500" type="submit" value={{ sifrovacka_id }} name='signupsif'>
<div class="btn__body ">Přihlásit se k šifrovačce</div>
</button>
</form>
{% else %}
<h1 class="head-alt-sm">Vaše Aktuální úroveň</h1>
{% for stage in sifrovacka_stages %}
{% if sifrovacka_current_stage_urlhash.at_stage == stage.stage_urlhash %}
<li><a href={% url 'stage' stage.sifrovacka_id stage.stage_urlhash %}>{{ stage }}</a></li>
{% endif %}
{% endfor %}
{% endif %}
{% else %}
<h1 class="head-alt-sm">Vaše Aktuální úroveň</h1>
{% for stage in sifrovacka_stages %}
{% if sifrovacka_current_stage_urlhash.at_stage == stage.stage_urlhash %}
<li><a href={% url 'stage' stage.sifrovacka_id stage.stage_urlhash %}>{{ stage }}</a></li>
{% endif %}
{% endfor %}
<div class="alert alert--grey-125">
<span> Šifrovačka skončila a není možné se k ní přihlásit.</span>
</div>
{% endif %}
{% else %}
<div class="alert alert--grey-125">
...
...
This diff is collapsed.
Click to expand it.
sifrovacka/views.py
+
4
−
1
View file @
acb490e3
...
...
@@ -148,6 +148,8 @@ def detail(request, sifrovacka_id):
#sifrovacka_detail = Sifrovacka.objects.get(id = sifrovacka_id)
sifrovacka_stages
=
Stages
.
objects
.
filter
(
sifrovacka__sifrovacka_name
=
sifrovacka_detail
)
sifrovacka_stage_count
=
sifrovacka_stages
.
count
()
is_archived_sifrovacka
=
Sifrovacka
.
objects
.
filter
(
id
=
sifrovacka_id
,
enddate_sifrovacka__lt
=
timezone
.
now
())
if
request
.
user
.
is_authenticated
:
sifrovacka_all_user_current_stages
=
Participants
.
objects
.
filter
(
user
=
\
request
.
user
).
filter
(
sifrovacka_id
=
\
...
...
@@ -167,7 +169,8 @@ def detail(request, sifrovacka_id):
"
sifrovacka_stage_count
"
:
sifrovacka_stage_count
,
"
sifrovacka_current_id
"
:
sifrovacka_current_id
,
"
sifrovacka_current_stage_urlhash
"
:
sifrovacka_current_stage_urlhash
sifrovacka_current_stage_urlhash
,
"
is_archived_sifrovacka
"
:
is_archived_sifrovacka
}
return
render
(
request
,
'
sifrovacka.html
'
,
context
)
...
...
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