Add badge-print view
This commit is contained in:
parent
7e1e800a74
commit
fd397068c8
3 changed files with 12 additions and 3 deletions
|
@ -73,9 +73,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- NOTE:
|
|
||||||
Workflow can be improved by using tickboxes for check-in, badge print, and swag, with a single submit button.
|
|
||||||
-->
|
|
||||||
<div class="card my-3">
|
<div class="card my-3">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h2 class="card-title">Check In</h2>
|
<h2 class="card-title">Check In</h2>
|
||||||
|
@ -110,6 +107,7 @@
|
||||||
<a type="button" class="btn btn-primary" href="badge">Show Badge</a>
|
<a type="button" class="btn btn-primary" href="badge">Show Badge</a>
|
||||||
<input class="btn" type="submit" value="Submit">
|
<input class="btn" type="submit" value="Submit">
|
||||||
</form>
|
</form>
|
||||||
|
<p><strong><a href="{% url 'badge_print' user.id %}" target="_blank">Show badge for printing</a></strong></p>
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<input type="checkbox" name="unbadge" value="unbadge" checked hidden>
|
<input type="checkbox" name="unbadge" value="unbadge" checked hidden>
|
||||||
<input class="btn" type="submit" value="Print Badge">
|
<input class="btn" type="submit" value="Print Badge">
|
||||||
|
|
2
vendor/registrasion/registrasion/urls.py
vendored
2
vendor/registrasion/registrasion/urls.py
vendored
|
@ -7,6 +7,7 @@ from .views import (
|
||||||
amend_registration,
|
amend_registration,
|
||||||
user_badge,
|
user_badge,
|
||||||
badge,
|
badge,
|
||||||
|
badge_print,
|
||||||
badger,
|
badger,
|
||||||
checkout,
|
checkout,
|
||||||
credit_note,
|
credit_note,
|
||||||
|
@ -30,6 +31,7 @@ public = [
|
||||||
url(r"^mybadge\.(png|svg|pdf)", user_badge, name="user_badge"),
|
url(r"^mybadge\.(png|svg|pdf)", user_badge, name="user_badge"),
|
||||||
url(r"^badge/([0-9]+)$", badge, name="badge"),
|
url(r"^badge/([0-9]+)$", badge, name="badge"),
|
||||||
url(r"^badge/([0-9]+).(png|svg|pdf)$", badge, name="badge"),
|
url(r"^badge/([0-9]+).(png|svg|pdf)$", badge, name="badge"),
|
||||||
|
url(r"^badge_print/([0-9]+).(png|svg|pdf)$", badge_print, name="badge_print"),
|
||||||
url(r"^badger/([A-Za-z0-9]+)$", badger, name="badger"),
|
url(r"^badger/([A-Za-z0-9]+)$", badger, name="badger"),
|
||||||
url(r"^badger/", badger, name="badger"),
|
url(r"^badger/", badger, name="badger"),
|
||||||
url(r"^category/([0-9]+)$", product_category, name="product_category"),
|
url(r"^category/([0-9]+)$", product_category, name="product_category"),
|
||||||
|
|
9
vendor/registrasion/registrasion/views.py
vendored
9
vendor/registrasion/registrasion/views.py
vendored
|
@ -1139,6 +1139,15 @@ def user_badge(request, format="png"):
|
||||||
overlay=False
|
overlay=False
|
||||||
return render_badge(request.user, format, overlay, request)
|
return render_badge(request.user, format, overlay, request)
|
||||||
|
|
||||||
|
@user_passes_test(_staff_only)
|
||||||
|
def badge_print(request, user_id, format="pdf"):
|
||||||
|
''' Renders a single user's badge overlay (PDF). '''
|
||||||
|
|
||||||
|
user_id = int(user_id)
|
||||||
|
user = User.objects.get(pk=user_id)
|
||||||
|
|
||||||
|
return render_badge(user, format=format, overlay=True)
|
||||||
|
|
||||||
@user_passes_test(_staff_only)
|
@user_passes_test(_staff_only)
|
||||||
def badge(request, user_id, format="png"):
|
def badge(request, user_id, format="png"):
|
||||||
''' Renders a single user's badge (PNG). '''
|
''' Renders a single user's badge (PNG). '''
|
||||||
|
|
Loading…
Reference in a new issue