Skip to content
This repository was archived by the owner on Apr 29, 2022. It is now read-only.

Commit 63116c0

Browse files
Haseeb Majidartcz
authored andcommitted
Removed Badge Code (#870)
* ⬆️ Moving simplejson to json Changed library from simplejson to json. Changed in all files that simplejson and removed the dependency from requirements file, as json is builtin. * Removed Badge Code Removed all code related to rendering badges.
1 parent 1b26a71 commit 63116c0

File tree

5 files changed

+5
-395
lines changed

5 files changed

+5
-395
lines changed

conference/admin.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ class SpeakerAdmin(admin.ModelAdmin):
456456
list_display = ('_avatar', '_user', '_email', '_company')
457457
search_fields = ('user__first_name', 'user__last_name', 'user__email',
458458
'user__attendeeprofile__company')
459-
list_filter = ('talk__conference', 'talk__status',
459+
list_filter = ('talk__conference', 'talk__status',
460460
'user__attendeeprofile__company')
461461
list_select_related = True
462462
form = SpeakerAdminForm
@@ -519,7 +519,7 @@ def _company(self, o):
519519
if o.user.attendeeprofile:
520520
return o.user.attendeeprofile.company
521521
_company.admin_order_field = 'user__attendeeprofile__company'
522-
522+
523523
def _email(self, o):
524524
return o.user.email
525525
_user.admin_order_field = 'user__email'
@@ -1037,7 +1037,7 @@ class TicketAdmin(admin.ModelAdmin):
10371037
list_filter = ('fare__conference', 'fare__ticket_type', 'ticket_type',)
10381038

10391039
if settings.TICKET_BADGE_ENABLED:
1040-
actions = ('do_ticket_badge',)
1040+
actions = ('',)
10411041

10421042
class Media:
10431043
js = (
@@ -1078,15 +1078,6 @@ def get_queryset(self, request):
10781078
qs = qs.select_related('user', 'fare',)
10791079
return qs
10801080

1081-
def do_ticket_badge(self, request, qs):
1082-
output = utils.render_badge(qs, cmdargs=settings.TICKET_BADGE_PROG_ARGS_ADMIN)
1083-
name, output_dir, _ = output[0]
1084-
tar = utils.archive_dir(output_dir)
1085-
response = http.HttpResponse(tar, content_type="application/x-gzip")
1086-
response['Content-Disposition'] = 'attachment; filename=badge-%s.tar.gz' % name
1087-
return response
1088-
do_ticket_badge.short_description = 'Ticket Badge'
1089-
10901081
def get_urls(self):
10911082
urls = super(TicketAdmin, self).get_urls()
10921083
my_urls = [

conference/management/commands/ticket_badge.py

Lines changed: 0 additions & 71 deletions
This file was deleted.

conference/tools/ticket_badge.py

Lines changed: 0 additions & 224 deletions
This file was deleted.

conference/utils.py

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ def collapse_events(tt, threshold):
390390
"""
391391
if isinstance(threshold, int):
392392
threshold = { None: threshold }
393-
393+
394394
output = []
395395
for time, events in tt.iterOnTimes():
396396
limits = []
@@ -483,7 +483,7 @@ def setEvent(self, time, o, duration, rows):
483483
for r in rows[1:]:
484484
ref = TimeTable.Reference(time, r, evt, flex)
485485
self._setEvent(ref, flex)
486-
486+
487487
step = self.sumTime(time, self.slot)
488488
while count > 1:
489489
for r in rows:
@@ -661,38 +661,6 @@ def render_event_video_cover(eid, thumb=(256, 256)):
661661

662662
return True
663663

664-
def render_badge(tickets, cmdargs=None, stderr=subprocess.PIPE):
665-
"""
666-
Prepare the badges of the past tickets.
667-
668-
The tickets are processed by the function settings.TICKET_BADGE_PREPARE_FUNCTION that can group them as they wish;
669-
each group is stored in a different directory.
670-
671-
The output contains a tuple of three elements for each group returned from preparation function:
672-
* Name of the group (v. settings.TICKET_BADGE_PREPARE_FUNCTION)
673-
* Directory containing the badge
674-
* JSON document passed as input to the rendering function.
675-
"""
676-
cmdargs = cmdargs or []
677-
output = []
678-
for group in settings.TICKET_BADGE_PREPARE_FUNCTION(tickets):
679-
temp_dir = tempfile.mkdtemp(prefix='%s-' % group['name'])
680-
args = [settings.TICKED_BADGE_PROG ] + cmdargs + [ '-c', group['plugin'], temp_dir]
681-
p = subprocess.Popen(
682-
args,
683-
stdin=subprocess.PIPE,
684-
stdout=subprocess.PIPE,
685-
stderr=stderr,
686-
close_fds=True,
687-
)
688-
data = json.dumps(group['tickets'])
689-
sout, serr = p.communicate(data)
690-
if p.returncode:
691-
log.warn('badge maker exit with "%s"', p.returncode)
692-
log.warn('badge maker stderr: %s', serr)
693-
output.append((group['name'], temp_dir, data))
694-
return output
695-
696664
def archive_dir(directory):
697665
from io import StringIO
698666
import tarfile

0 commit comments

Comments
 (0)