From a1f3ba72f47d6a3868ac478ea220b7fcccceea94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=92=E1=85=AA=E1=86=AB?= Date: Mon, 5 Aug 2019 19:07:22 +0900 Subject: [PATCH 01/35] =?UTF-8?q?=EA=B6=8C=ED=95=9C=EC=9D=84=20=EC=82=AC?= =?UTF-8?q?=EC=9A=A9=ED=95=98=EA=B8=B0=20=EC=9C=84=ED=95=9C=20=EA=B8=B0?= =?UTF-8?q?=EC=B4=88=20=EB=82=B4=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ticket/views.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 ticket/views.py diff --git a/ticket/views.py b/ticket/views.py new file mode 100644 index 0000000..cdaae9c --- /dev/null +++ b/ticket/views.py @@ -0,0 +1,18 @@ +from django.contrib.auth.decorators import user_passes_test +from django.shortcuts import render + + +def group_required(*group_names): + def in_groups(u): + if u.is_authenticated(): + if bool(u.groups.filter(name__in=group_names)) or u.is_superuser: + return True + return False + + return user_passes_test(in_groups) + + +@group_required('admin', 'organizer', 'volunteer') +def issue(request): + pass + From 9b58e2f446dd8278f5f4c6d54e3a81e1ea35ac46 Mon Sep 17 00:00:00 2001 From: amazingguni Date: Mon, 5 Aug 2019 19:21:34 +0900 Subject: [PATCH 02/35] =?UTF-8?q?=EB=93=B1=EB=A1=9D=20=EC=97=AC=EB=B6=80?= =?UTF-8?q?=20=ED=99=95=EC=9D=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ticket/admin.py | 22 ++++++++++++++--- ticket/migrations/0023_auto_20190805_1858.py | 26 ++++++++++++++++++++ ticket/models.py | 6 ++++- 3 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 ticket/migrations/0023_auto_20190805_1858.py diff --git a/ticket/admin.py b/ticket/admin.py index c672eed..773007a 100644 --- a/ticket/admin.py +++ b/ticket/admin.py @@ -3,6 +3,7 @@ from django.contrib import admin from django.contrib import messages from django.utils import timezone +from django.utils.formats import localize from django.utils.translation import ugettext_lazy as _ from iamport import Iamport from import_export import fields @@ -12,6 +13,8 @@ from api.models.profile import Profile from ticket.models import Ticket, TicketProduct, TicketForRegistration from ticket.schemas import create_iamport +from django.utils.html import format_html_join +from django.utils.safestring import mark_safe class TicketProductResource(resources.ModelResource): @@ -71,7 +74,7 @@ class TicketAdmin(ImportExportModelAdmin): 'product__type', ('product', admin.RelatedOnlyFieldListFilter), ) - actions = ['refund', 'set_paid'] + actions = ['refund', 'set_paid', 'register'] def options_str(self, obj): if not obj.options: @@ -80,6 +83,9 @@ def options_str(self, obj): return obj.options return '\n'.join([f'{k}: {v}' for k, v in obj.options.items()]) + def register(self, obj): + obj.registration_set.create(registered_at=timezone.now()) + def refund(self, request, queryset): for ticket in queryset: if ticket.status != Ticket.STATUS_PAID: @@ -116,14 +122,24 @@ def set_paid(self, request, queryset): class TicketForRegistrationAdmin(admin.ModelAdmin): autocomplete_fields = ['owner'] - list_display = ('id', 'status', 'product_type', 'product', 'owner_oauth_type', 'owner_name', 'owner_email', - 'owner_organization', 'options_str') + list_display = ('id', 'status', 'registrations', 'product_type', 'product', 'owner_oauth_type', 'owner_name', + 'owner_email', 'owner_organization', 'options_str') search_fields = ['id', 'owner__profile__email', 'owner__profile__name_ko', 'owner__profile__name_en'] list_filter = ( 'status', 'product__type', ('product', admin.RelatedOnlyFieldListFilter), ) + actions = ['register'] + + def register(self, request, queryset): + for ticket in queryset: + ticket.registration_set.create(registered_at=timezone.now()) + + def registrations(self, obj): + return format_html_join( + mark_safe('
'), '{}', + ((localize(r.registered_at),) for r in obj.registration_set.all())) def options_str(self, obj): if not obj.options: diff --git a/ticket/migrations/0023_auto_20190805_1858.py b/ticket/migrations/0023_auto_20190805_1858.py new file mode 100644 index 0000000..8fc2377 --- /dev/null +++ b/ticket/migrations/0023_auto_20190805_1858.py @@ -0,0 +1,26 @@ +# Generated by Django 2.2 on 2019-08-05 09:58 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('ticket', '0022_ticketforregistration'), + ] + + operations = [ + migrations.RemoveField( + model_name='ticket', + name='registered_at', + ), + migrations.CreateModel( + name='Registration', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('registered_at', models.DateTimeField(blank=True, null=True)), + ('ticket', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='ticket.Ticket')), + ], + ), + ] diff --git a/ticket/models.py b/ticket/models.py index e303847..f353936 100644 --- a/ticket/models.py +++ b/ticket/models.py @@ -161,7 +161,6 @@ class Ticket(TransactionMixin, models.Model): owner = models.ForeignKey(UserModel, on_delete=models.CASCADE) product = models.ForeignKey(TicketProduct, on_delete=models.CASCADE) options = JSONField(default='{}') - registered_at = models.DateTimeField(null=True, blank=True) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) @@ -198,6 +197,11 @@ def owner_organization(self): return '' +class Registration(models.Model): + ticket = models.ForeignKey(Ticket, on_delete=models.CASCADE) + registered_at = models.DateTimeField(null=True, blank=True) + + class TicketForRegistration(Ticket): class Meta: proxy = True From 5c83f8ea51892458fb2f6c68a6a31f93cc2a6ddb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=92=E1=85=AA=E1=86=AB?= Date: Mon, 5 Aug 2019 20:12:46 +0900 Subject: [PATCH 03/35] =?UTF-8?q?QR=20=EB=A6=AC=EB=8D=94=EA=B8=B0=EB=A1=9C?= =?UTF-8?q?=20=EC=9D=BD=EB=8A=94=20=EA=B2=BD=EC=9A=B0=EB=A5=BC=20=EA=B0=80?= =?UTF-8?q?=EC=A0=95=ED=95=9C=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ticket/admin.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ticket/admin.py b/ticket/admin.py index c672eed..d1ac129 100644 --- a/ticket/admin.py +++ b/ticket/admin.py @@ -132,5 +132,19 @@ def options_str(self, obj): return obj.options return '\n'.join([f'{k}: {v}' for k, v in obj.options.items()]) + def get_search_results(self, request, queryset, search_term): + queryset, use_distinct = super().get_search_results(request, queryset, search_term) + + if search_term is None: + return queryset, use_distinct + + # INFO: QR 코드로 읽는 경우를 가정한다. + if search_term.startswith('https://www.pycon.kr/ticket/my-ticket?id=VGlja2V0Tm9kZToxNzk2'): + queryset = Ticket.objects.filter(id=2) + + return queryset, False + + return queryset, use_distinct + admin.site.register(TicketForRegistration, TicketForRegistrationAdmin) From 81bcd48406b7a076c2a9159fa8f6ff1af973ec46 Mon Sep 17 00:00:00 2001 From: amazingguni Date: Mon, 5 Aug 2019 20:15:46 +0900 Subject: [PATCH 04/35] Remove unused group --- ticket/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ticket/views.py b/ticket/views.py index cdaae9c..44dc54d 100644 --- a/ticket/views.py +++ b/ticket/views.py @@ -12,7 +12,7 @@ def in_groups(u): return user_passes_test(in_groups) -@group_required('admin', 'organizer', 'volunteer') +@group_required('registration_helper') def issue(request): pass From c72a37004632e47315c07177547208d35eb9b611 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=92=E1=85=AA=E1=86=AB?= Date: Mon, 5 Aug 2019 20:43:25 +0900 Subject: [PATCH 05/35] =?UTF-8?q?=EB=93=B1=EB=A1=9D=EC=8B=9C=20=EB=B6=88?= =?UTF-8?q?=ED=95=84=EC=9A=94=ED=95=A0=20=ED=95=AD=EB=AA=A9=EC=97=90=20?= =?UTF-8?q?=EB=8C=80=ED=95=B4=EC=84=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ticket/admin.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/ticket/admin.py b/ticket/admin.py index cbdaa0c..5806d69 100644 --- a/ticket/admin.py +++ b/ticket/admin.py @@ -122,14 +122,10 @@ def set_paid(self, request, queryset): class TicketForRegistrationAdmin(admin.ModelAdmin): autocomplete_fields = ['owner'] - list_display = ('id', 'status', 'registrations', 'product_type', 'product', 'owner_oauth_type', 'owner_name', - 'owner_email', 'owner_organization', 'options_str') + list_display = ('owner_name', 'owner_email', 'product_type', 'status', 'registrations', 'product', + 'options_str') search_fields = ['id', 'owner__profile__email', 'owner__profile__name_ko', 'owner__profile__name_en'] - list_filter = ( - 'status', - 'product__type', - ('product', admin.RelatedOnlyFieldListFilter), - ) + list_filter = ('status', 'product__type', ) actions = ['register'] def register(self, request, queryset): From d7039fc45aad98840fe4a4c8273cf144c5c091ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=92=E1=85=AA=E1=86=AB?= Date: Mon, 5 Aug 2019 20:50:23 +0900 Subject: [PATCH 06/35] =?UTF-8?q?=EB=AA=A8=EB=93=A0=20=EC=9C=A0=EC=A0=B8?= =?UTF-8?q?=EC=9D=98=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=EB=A5=BC=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=ED=95=A0=20=EC=88=98=20=EC=97=86=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=A1=B0=EC=B9=98=ED=95=9C=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ticket/admin.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ticket/admin.py b/ticket/admin.py index 5806d69..ad823fd 100644 --- a/ticket/admin.py +++ b/ticket/admin.py @@ -145,10 +145,11 @@ def options_str(self, obj): return '\n'.join([f'{k}: {v}' for k, v in obj.options.items()]) def get_search_results(self, request, queryset, search_term): - queryset, use_distinct = super().get_search_results(request, queryset, search_term) + # INFO: 모든 유져의 리스트를 조회할 수 없도록 한다. + if not search_term: + return TicketForRegistration.objects.none(), False - if search_term is None: - return queryset, use_distinct + queryset, use_distinct = super().get_search_results(request, queryset, search_term) # INFO: QR 코드로 읽는 경우를 가정한다. if search_term.startswith('https://www.pycon.kr/ticket/my-ticket?id=VGlja2V0Tm9kZToxNzk2'): From 726c12d598245276d549dca490f1fd8d91a067ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=92=E1=85=AA=E1=86=AB?= Date: Mon, 5 Aug 2019 20:52:13 +0900 Subject: [PATCH 07/35] =?UTF-8?q?=EB=92=A4=EC=97=90=20=EA=B3=A0=EC=A0=95?= =?UTF-8?q?=EB=90=98=EC=96=B4=20=EC=9E=88=EB=8A=94=20=EC=8A=A4=ED=8A=B8?= =?UTF-8?q?=EB=A7=81=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ticket/admin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ticket/admin.py b/ticket/admin.py index f6a36a5..1289bf6 100644 --- a/ticket/admin.py +++ b/ticket/admin.py @@ -153,7 +153,7 @@ def get_search_results(self, request, queryset, search_term): queryset, use_distinct = super().get_search_results(request, queryset, search_term) # INFO: QR 코드로 읽는 경우를 가정한다. - if search_term.startswith('https://www.pycon.kr/ticket/my-ticket?id=VGlja2V0Tm9kZToxNzk2'): + if search_term.startswith('https://www.pycon.kr/ticket/my-ticket?id='): global_id = search_term.split('=')[1] _, pk = from_global_id(global_id) queryset = Ticket.objects.filter(id=pk) From 2a3cdaa1139578d133d2e99ac5487ffc674a8e40 Mon Sep 17 00:00:00 2001 From: amazingguni Date: Mon, 5 Aug 2019 21:25:18 +0900 Subject: [PATCH 08/35] =?UTF-8?q?=EB=93=B1=EB=A1=9D=ED=95=98=EA=B8=B0=20?= =?UTF-8?q?=EB=B2=84=ED=8A=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ticket/admin.py | 14 +++++++------- ticket/templates/issue.html | 10 ++++++++++ 2 files changed, 17 insertions(+), 7 deletions(-) create mode 100644 ticket/templates/issue.html diff --git a/ticket/admin.py b/ticket/admin.py index f955697..b2a55c8 100644 --- a/ticket/admin.py +++ b/ticket/admin.py @@ -14,7 +14,7 @@ from api.models.profile import Profile from ticket.models import Ticket, TicketProduct, TicketForRegistration from ticket.schemas import create_iamport -from django.utils.html import format_html_join +from django.utils.html import format_html_join, format_html from django.utils.safestring import mark_safe @@ -123,19 +123,19 @@ def set_paid(self, request, queryset): class TicketForRegistrationAdmin(admin.ModelAdmin): autocomplete_fields = ['owner'] - list_display = ('id', 'status', 'registrations', 'product_type', 'product', 'owner_oauth_type', 'owner_name', - 'owner_email', 'owner_organization', 'options_str') + list_display = ('id', 'register', 'status', 'registrations', 'product_type', 'product', 'owner_oauth_type', + 'owner_name', 'owner_email', 'owner_organization', 'options_str') + readonly_fields = ('register',) search_fields = ['id', 'owner__profile__email', 'owner__profile__name_ko', 'owner__profile__name_en'] list_filter = ( 'status', 'product__type', ('product', admin.RelatedOnlyFieldListFilter), ) - actions = ['register'] - def register(self, request, queryset): - for ticket in queryset: - ticket.registration_set.create(registered_at=timezone.now()) + def register(self, obj): + url = 'https://www.naver.com' + return format_html(f'등록하기') def registrations(self, obj): return format_html_join( diff --git a/ticket/templates/issue.html b/ticket/templates/issue.html new file mode 100644 index 0000000..f7e5884 --- /dev/null +++ b/ticket/templates/issue.html @@ -0,0 +1,10 @@ + + + + + Codestin Search App + + +$END$ + + \ No newline at end of file From d33e6db29d0a356b16fbf24dc8bad724d1d8d22d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=92=E1=85=AA=E1=86=AB?= Date: Mon, 5 Aug 2019 21:29:30 +0900 Subject: [PATCH 09/35] =?UTF-8?q?=ED=8B=B0=EC=BC=93=20=EC=B6=9C=EB=A0=A5?= =?UTF-8?q?=EC=9D=84=20=EC=9C=84=ED=95=9C=20=EA=B8=B0=EB=B3=B8=20=EC=9C=A4?= =?UTF-8?q?=EA=B3=BD=EC=9D=84=20=EC=9E=91=EC=84=B1=ED=95=98=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyconkr/urls.py | 3 ++- ticket/templates/issue.html | 19 +++++++++++++++++++ ticket/urls.py | 7 +++++++ ticket/views.py | 23 ++++++++++++++++++++--- 4 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 ticket/templates/issue.html create mode 100644 ticket/urls.py diff --git a/pyconkr/urls.py b/pyconkr/urls.py index bf8707f..38acab7 100644 --- a/pyconkr/urls.py +++ b/pyconkr/urls.py @@ -4,7 +4,8 @@ from django.conf.urls.static import static urlpatterns = [ - path('api/', include('api.urls')) + path('api/', include('api.urls')), + path('ticket/', include('ticket.urls')), ] if settings.DEBUG: diff --git a/ticket/templates/issue.html b/ticket/templates/issue.html new file mode 100644 index 0000000..c8d0602 --- /dev/null +++ b/ticket/templates/issue.html @@ -0,0 +1,19 @@ + + + + + Codestin Search App + + +

{{ owner.profile.name }}님

+ +{% if young_coder %} +

영코더 버튼을 전달

+{% endif %} + +{% if child_care %} +

차일드 케어 내용을 안내

+{% endif %} + + + \ No newline at end of file diff --git a/ticket/urls.py b/ticket/urls.py new file mode 100644 index 0000000..556a0d4 --- /dev/null +++ b/ticket/urls.py @@ -0,0 +1,7 @@ +from django.urls import path + +from ticket.views import issue + +urlpatterns = [ + path('issue//', issue, name='ticket_issue'), +] diff --git a/ticket/views.py b/ticket/views.py index 44dc54d..b1f87c1 100644 --- a/ticket/views.py +++ b/ticket/views.py @@ -1,5 +1,8 @@ from django.contrib.auth.decorators import user_passes_test -from django.shortcuts import render +from django.shortcuts import render, get_object_or_404 +from graphql_relay import from_global_id + +from ticket.models import Ticket def group_required(*group_names): @@ -13,6 +16,20 @@ def in_groups(u): @group_required('registration_helper') -def issue(request): - pass +def issue(request, global_id): + _, pk = from_global_id(global_id) + ticket = get_object_or_404(Ticket, id=pk) + owner = ticket.owner + + young_coder = False + child_care = True + # tutorial = [] + # sprint = [] + + context = { + 'owner': owner, + 'young_coder': young_coder, + 'child_care': child_care, + } + return render(request, 'issue.html', context=context) From e52371e338c0c02e4daa827f1e0b5e87a68cd13f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=92=E1=85=AA=E1=86=AB?= Date: Mon, 5 Aug 2019 21:30:06 +0900 Subject: [PATCH 10/35] =?UTF-8?q?=EB=B3=80=EA=B2=BD=EB=90=9C=20API=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=EC=9D=84=20=EC=88=98=EC=A0=95=ED=95=98?= =?UTF-8?q?=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ticket/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ticket/views.py b/ticket/views.py index b1f87c1..3bcc069 100644 --- a/ticket/views.py +++ b/ticket/views.py @@ -7,7 +7,7 @@ def group_required(*group_names): def in_groups(u): - if u.is_authenticated(): + if u.is_authenticated: if bool(u.groups.filter(name__in=group_names)) or u.is_superuser: return True return False From 510284a52a2f511b3688dd6d4f66c98301866bf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=92=E1=85=AA=E1=86=AB?= Date: Mon, 5 Aug 2019 21:48:24 +0900 Subject: [PATCH 11/35] =?UTF-8?q?=EB=93=B1=EB=A1=9D=20=EC=B2=98=EB=A6=AC?= =?UTF-8?q?=20=ED=8E=98=EC=9D=B4=EC=A7=80=EC=9D=98=20=EA=B8=B0=EB=B3=B8=20?= =?UTF-8?q?=ED=8B=80=EC=9D=84=20=EC=9E=A1=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ticket/admin.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/ticket/admin.py b/ticket/admin.py index e4f7254..deb83ec 100644 --- a/ticket/admin.py +++ b/ticket/admin.py @@ -2,10 +2,11 @@ from django.contrib import admin from django.contrib import messages +from django.urls import reverse from django.utils import timezone from django.utils.formats import localize from django.utils.translation import ugettext_lazy as _ -from graphql_relay import from_global_id +from graphql_relay import from_global_id, to_global_id from iamport import Iamport from import_export import fields from import_export import resources @@ -123,20 +124,18 @@ def set_paid(self, request, queryset): class TicketForRegistrationAdmin(admin.ModelAdmin): autocomplete_fields = ['owner'] - list_display = ('owner_name', 'owner_email', 'product_type', 'status', 'registrations', 'product', + list_display = ('owner_name_with_reg', 'owner_email', 'product_type', 'status', 'registrations', 'product', 'options_str') - readonly_fields = ('register',) search_fields = ['id', 'owner__profile__email', 'owner__profile__name_ko', 'owner__profile__name_en'] list_filter = ('status', 'product__type', ) actions = ['register'] - def register(self, request, queryset): - for ticket in queryset: - ticket.registration_set.create(registered_at=timezone.now()) - def register(self, obj): - # FIXME: global_id 관련 처리를 해야 함 - url = 'https://www.naver.com' - return format_html(f'등록하기') + def owner_name_with_reg(self, obj): + global_id = to_global_id('TicketNode', obj.id) + url = reverse('ticket_issue', args=[global_id]), + # FIXME: reverse return 이 튜플로 됨 + return format_html(f'{obj.owner_name}') + owner_name_with_reg.short_description = '이름' def registrations(self, obj): return format_html_join( From da3cbbd48b9a9b4df61363d8ca445f09feb19d21 Mon Sep 17 00:00:00 2001 From: amazingguni Date: Mon, 5 Aug 2019 22:15:09 +0900 Subject: [PATCH 12/35] =?UTF-8?q?=ED=85=9C=ED=94=8C=EB=A6=BF=EC=97=90=20?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EC=B4=88=EC=95=88=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/models/profile.py | 4 ++-- api/schemas/user.py | 2 +- ticket/templates/issue.html | 30 +++++++++++++++++++++++++++--- ticket/views.py | 12 +++--------- 4 files changed, 33 insertions(+), 15 deletions(-) diff --git a/api/models/profile.py b/api/models/profile.py index a2da47f..aad2f7f 100644 --- a/api/models/profile.py +++ b/api/models/profile.py @@ -93,9 +93,9 @@ def has_youngcoder(self): ).exists() @property - def has_babycare(self): + def has_childcare(self): return Ticket.objects.filter( - product__type=TicketProduct.TYPE_BABY_CARE, + product__type=TicketProduct.TYPE_CHILD_CARE, owner=self.user, status=Ticket.STATUS_PAID ).exists() diff --git a/api/schemas/user.py b/api/schemas/user.py index 612347e..eb71069 100644 --- a/api/schemas/user.py +++ b/api/schemas/user.py @@ -48,7 +48,7 @@ class Meta: is_sprint_owner = graphene.Boolean(source='is_sprint_owner') is_tutorial_owner = graphene.Boolean(source='is_tutorial_owner') has_youngcoder = graphene.Boolean(source='has_youngcoder') - has_babycare = graphene.Boolean(source='has_babycare') + has_childcare = graphene.Boolean(source='has_childcare') def resolve_image(self, info): if self.image.name: diff --git a/ticket/templates/issue.html b/ticket/templates/issue.html index c8d0602..952b508 100644 --- a/ticket/templates/issue.html +++ b/ticket/templates/issue.html @@ -5,13 +5,37 @@ Codestin Search App -

{{ owner.profile.name }}님

+{% if ticket.product.type != 'C' %} +

{{ ticket.product.name }}

+{% endif %} +

{{ profile.name }}님

+

{{ profile.organization }}

+ +{% if profile.is_patron %} +

개인후원 버튼을 전달

+{% endif %} + +{% if profile.is_open_reviewer %} +

오픈리뷰어 버튼을 전달

+{% endif %} + +{% if profile.is_speaker %} +

발표자 버튼을 전달

+{% endif %} + +{% if profile.is_tutorial_owner %} +

튜토리얼 진행자 버튼을 전달

+{% endif %} + +{% if profile.is_sprint_owner %} +

스프린트 진행자 버튼을 전달

+{% endif %} -{% if young_coder %} +{% if profile.has_youngcoder %}

영코더 버튼을 전달

{% endif %} -{% if child_care %} +{% if profile.has_childcare %}

차일드 케어 내용을 안내

{% endif %} diff --git a/ticket/views.py b/ticket/views.py index 3bcc069..c658fd4 100644 --- a/ticket/views.py +++ b/ticket/views.py @@ -19,17 +19,11 @@ def in_groups(u): def issue(request, global_id): _, pk = from_global_id(global_id) ticket = get_object_or_404(Ticket, id=pk) - owner = ticket.owner - - young_coder = False - child_care = True - # tutorial = [] - # sprint = [] + profile = ticket.owner.profile context = { - 'owner': owner, - 'young_coder': young_coder, - 'child_care': child_care, + 'profile': profile, + 'ticket': ticket } return render(request, 'issue.html', context=context) From d9d1e91cd432d6e46385c26edbd12357828e7e3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=92=E1=85=AA=E1=86=AB?= Date: Mon, 5 Aug 2019 22:16:09 +0900 Subject: [PATCH 13/35] =?UTF-8?q?=EC=9D=B4=EC=A0=84=EC=97=90=20=EC=82=AC?= =?UTF-8?q?=EC=9A=A9=ED=95=9C=20=ED=94=84=EB=A6=B0=ED=8A=B8=20=EC=B6=9C?= =?UTF-8?q?=EB=A0=A5=20=EB=82=B4=EC=9A=A9=EC=9D=84=20=EC=9E=91=EC=84=B1?= =?UTF-8?q?=ED=95=98=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ticket/templates/issue.html | 70 +++++++++++++++++++++++++++++++++---- 1 file changed, 63 insertions(+), 7 deletions(-) diff --git a/ticket/templates/issue.html b/ticket/templates/issue.html index c8d0602..ffafa75 100644 --- a/ticket/templates/issue.html +++ b/ticket/templates/issue.html @@ -3,17 +3,73 @@ Codestin Search App + -

{{ owner.profile.name }}님

-{% if young_coder %} -

영코더 버튼을 전달

-{% endif %} +
+
+ {% if young_coder %} +

영코더 버튼을 전달

+ {% endif %} + + {% if child_care %} +

차일드 케어 내용을 안내

+ {% endif %} +
+ {{ csrf }} + +
+
+
+
{{ owner.profile.name }}
+
{{ owner.profile.organization }}
+
+ +
+ + -{% if child_care %} -

차일드 케어 내용을 안내

-{% endif %} \ No newline at end of file From bcba259b38720c1572e2aa1add72e5e65118107c Mon Sep 17 00:00:00 2001 From: amazingguni Date: Mon, 5 Aug 2019 22:17:57 +0900 Subject: [PATCH 14/35] =?UTF-8?q?=ED=8B=B0=EC=85=94=EC=B8=A0=20=EC=82=AC?= =?UTF-8?q?=EC=9D=B4=EC=A6=88=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ticket/templates/issue.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ticket/templates/issue.html b/ticket/templates/issue.html index 952b508..b43fc3f 100644 --- a/ticket/templates/issue.html +++ b/ticket/templates/issue.html @@ -5,6 +5,10 @@ Codestin Search App +{% if 'tshirtsize' in ticket.options %} +

{{ ticket.options.tshirtsize }}

+{% endif %} + {% if ticket.product.type != 'C' %}

{{ ticket.product.name }}

{% endif %} From e0141e085dfc5d6ca69ed10428471c562b0a3258 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=92=E1=85=AA=E1=86=AB?= Date: Mon, 5 Aug 2019 22:23:16 +0900 Subject: [PATCH 15/35] =?UTF-8?q?=EC=9D=B4=EB=A6=84=EA=B3=BC=20=EC=86=8C?= =?UTF-8?q?=EC=86=8D=EC=9D=B4=20=EB=B3=B4=EC=9D=B4=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ticket/templates/issue.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ticket/templates/issue.html b/ticket/templates/issue.html index 09106e9..fc8a0f7 100644 --- a/ticket/templates/issue.html +++ b/ticket/templates/issue.html @@ -85,8 +85,8 @@
-
{{ owner.profile.name }}
-
{{ owner.profile.organization }}
+
{{ profile.name }}
+
{{ profile.organization }}
From c388efe34e788a49e8e8b81df290de64a004dbb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=92=E1=85=AA=E1=86=AB?= Date: Tue, 6 Aug 2019 05:02:23 +0900 Subject: [PATCH 16/35] =?UTF-8?q?=EA=B2=BD=EA=B3=A0=20=EB=A9=94=EC=8B=9C?= =?UTF-8?q?=EC=A7=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ticket/migrations/0024_auto_20190806_0501.py | 19 +++++++++++++++++++ ticket/models.py | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 ticket/migrations/0024_auto_20190806_0501.py diff --git a/ticket/migrations/0024_auto_20190806_0501.py b/ticket/migrations/0024_auto_20190806_0501.py new file mode 100644 index 0000000..54f25b4 --- /dev/null +++ b/ticket/migrations/0024_auto_20190806_0501.py @@ -0,0 +1,19 @@ +# Generated by Django 2.2.2 on 2019-08-05 20:01 + +import django.contrib.postgres.fields.jsonb +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('ticket', '0023_auto_20190805_1858'), + ] + + operations = [ + migrations.AlterField( + model_name='ticket', + name='options', + field=django.contrib.postgres.fields.jsonb.JSONField(default=dict), + ), + ] diff --git a/ticket/models.py b/ticket/models.py index f353936..d36ba33 100644 --- a/ticket/models.py +++ b/ticket/models.py @@ -160,7 +160,7 @@ class Meta: class Ticket(TransactionMixin, models.Model): owner = models.ForeignKey(UserModel, on_delete=models.CASCADE) product = models.ForeignKey(TicketProduct, on_delete=models.CASCADE) - options = JSONField(default='{}') + options = JSONField(default=dict) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) From c505873fd16bcaec7cb8a51f42748eee4852e10f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=92=E1=85=AA=E1=86=AB?= Date: Tue, 6 Aug 2019 06:54:43 +0900 Subject: [PATCH 17/35] =?UTF-8?q?=EB=8C=80=EC=B6=A9=EC=9D=98=20=EC=9C=A4?= =?UTF-8?q?=EA=B3=BD=EC=9D=84=20=EB=A7=9E=EC=B6=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ticket/templates/issue.html | 203 ++++++++++++++++++++++++++++++++++-- 1 file changed, 197 insertions(+), 6 deletions(-) diff --git a/ticket/templates/issue.html b/ticket/templates/issue.html index fc8a0f7..c156650 100644 --- a/ticket/templates/issue.html +++ b/ticket/templates/issue.html @@ -1,3 +1,4 @@ +{% load staticfiles %} @@ -11,18 +12,27 @@ .name-tag .name { font-family: 'Jeju Gothic', serif; position:relative; - font-size: 15mm; - top: 2mm; + font-size: 30mm; + top: 80mm; text-align: center; } .name-tag .org { font-family: 'Jeju Gothic', serif; color: gray; - font-size: 5mm; + font-size: 10mm; position:relative; - top: 2mm; + top: 80mm; text-align: center; } +.name-tag .gift { + font-family: 'Jeju Gothic', serif; + color: gray; + font-size: 10mm; + position:relative; + top: 10mm; + left: 125mm; + width: 40mm; +} @page { size: A4; @@ -85,15 +95,196 @@
-
{{ profile.name }}
-
{{ profile.organization }}
+
L(100)
+
{{ profile.name }}
+
{{ profile.organization }}
+ From 608fe604e737112230bfa92268da73efa32fb1ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=92=E1=85=AA=E1=86=AB?= Date: Fri, 9 Aug 2019 19:59:46 +0900 Subject: [PATCH 22/35] =?UTF-8?q?=ED=8A=9C=ED=86=A0=EB=A6=AC=EC=96=BC=20?= =?UTF-8?q?=EB=82=B4=EC=9A=A9=EA=B3=BC=20=EC=BB=A8=ED=8D=BC=EB=9F=B0?= =?UTF-8?q?=EC=8A=A4=20=ED=8B=B0=EC=BC=93=20=EB=82=B4=EC=9A=A9=EC=9D=84=20?= =?UTF-8?q?=EC=B6=9C=EB=A0=A5=ED=95=98=EB=8F=84=EB=A1=9D=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20=ED=8A=9C=ED=86=A0=EB=A6=AC=EC=96=BC=20=EB=82=B4?= =?UTF-8?q?=EC=9A=A9=EC=9D=84=20=EC=96=B4=EB=8A=90=EC=A0=95=EB=8F=84=20?= =?UTF-8?q?=EC=A7=A7=EA=B2=8C=20=EC=A0=95=ED=95=98=EC=98=80=EC=9D=8C=20?= =?UTF-8?q?=EC=9D=B4=EB=A6=84=20=EC=98=81=EC=97=AD=EC=9D=84=20=EC=9A=B0?= =?UTF-8?q?=EC=84=A0=20=EA=B3=A0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ticket/templates/issue.html | 32 ++++++++++++++++---------------- ticket/views.py | 6 ++++-- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/ticket/templates/issue.html b/ticket/templates/issue.html index a0d5e18..f6e0fde 100644 --- a/ticket/templates/issue.html +++ b/ticket/templates/issue.html @@ -28,29 +28,31 @@ left: 51mm; width: 109mm; height: 66mm; + text-align: center; } .name-box .product { font-family: 'Jeju Gothic', serif; position:relative; - font-size: 8mm; - top: 15mm; - text-align: center; + display: inline-block; + font-size: 6mm; + margin-top: 2mm; + width: 95%; + margin-right: 2mm; + text-align: right; } .name-box .name { font-family: 'Jeju Gothic', serif; position:relative; - width: 95mm; - margin: 0 auto; - top: 20mm; - text-align: center; + display: inline-block; + width: 105mm; } .name-box .org { font-family: 'Jeju Gothic', serif; - color: gray; - font-size: 10mm; + font-size: 6mm; position:relative; - top: 80mm; - text-align: center; + display: inline-block; + color: gray; + top: 5mm; } .message-box { position:absolute; @@ -100,11 +102,9 @@ {{ tshirtsize }}
- {% if product %} -
{{ product }}
- {% endif %} -
{{ profile.name }}
-
{{ profile.organization }}
+ {{ product }} + {{ profile.name }} + {{ profile.organization }}
{% for message in additional_message %} diff --git a/ticket/views.py b/ticket/views.py index b1d37a2..70399c6 100644 --- a/ticket/views.py +++ b/ticket/views.py @@ -63,7 +63,7 @@ def issue(request, global_id): 168: '', 169: 'Pytest', 170: '', - 171: '', + 171: 'Data Science with Python', 172: 'Django in Beanstalk', 173: '', 174: '', @@ -75,8 +75,10 @@ def issue(request, global_id): if ticket.product.type == TicketProduct.TYPE_TUTORIAL: product = tutorial_keys[ticket.product.tutorial_set.first().id] + elif ticket.product.type == TicketProduct.TYPE_CONFERENCE: + product = 'PYCON KOREA 2019' else: - product = None + product = '' context = { 'profile': profile, From 338027fc8ec6c637fc582bbb415b51fa4a2d6e3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=92=E1=85=AA=E1=86=AB?= Date: Fri, 9 Aug 2019 22:47:21 +0900 Subject: [PATCH 23/35] =?UTF-8?q?global=5Fid=20=EC=97=90=20=3D=20=EC=9D=B4?= =?UTF-8?q?=20=ED=8F=AC=ED=95=A8=EB=90=98=EC=96=B4=20urls.py=20=EB=A5=BC?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ticket/urls.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ticket/urls.py b/ticket/urls.py index 556a0d4..36e1ceb 100644 --- a/ticket/urls.py +++ b/ticket/urls.py @@ -1,7 +1,7 @@ -from django.urls import path +from django.urls import re_path from ticket.views import issue urlpatterns = [ - path('issue//', issue, name='ticket_issue'), + re_path(r'^issue/(?P[\w=]+)/', issue, name='ticket_issue'), ] From 55f6917119ee25c6b09030b50b0f8d9ef532f05d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=92=E1=85=AA=E1=86=AB?= Date: Fri, 9 Aug 2019 22:47:38 +0900 Subject: [PATCH 24/35] =?UTF-8?q?options=20=EB=8A=94=20=EA=B5=B3=EC=9D=B4?= =?UTF-8?q?=20=EB=93=B1=EB=A1=9D=EA=B3=BC=EC=A0=95=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EB=B3=B4=EC=97=AC=EC=A4=84=20=ED=95=84=EC=9A=94=EA=B0=80=20?= =?UTF-8?q?=EC=97=86=EC=96=B4=EC=84=9C=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ticket/admin.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ticket/admin.py b/ticket/admin.py index deb83ec..274b130 100644 --- a/ticket/admin.py +++ b/ticket/admin.py @@ -124,8 +124,7 @@ def set_paid(self, request, queryset): class TicketForRegistrationAdmin(admin.ModelAdmin): autocomplete_fields = ['owner'] - list_display = ('owner_name_with_reg', 'owner_email', 'product_type', 'status', 'registrations', 'product', - 'options_str') + list_display = ('owner_name_with_reg', 'owner_email', 'product_type', 'status', 'registrations', 'product', ) search_fields = ['id', 'owner__profile__email', 'owner__profile__name_ko', 'owner__profile__name_en'] list_filter = ('status', 'product__type', ) actions = ['register'] From 70a9c8eba7abf0ed2da2a751598e618d7fd36a20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=92=E1=85=AA=E1=86=AB?= Date: Fri, 9 Aug 2019 22:48:04 +0900 Subject: [PATCH 25/35] =?UTF-8?q?=EC=9A=B0=EC=84=A0=EC=9D=80=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D=EB=90=9C=20=ED=8A=9C=ED=86=A0=EB=A6=AC=EC=96=BC?= =?UTF-8?q?=EC=97=90=20=EC=A7=A7=EC=9D=80=20=EC=9D=B4=EB=A6=84=EC=9D=84=20?= =?UTF-8?q?=EC=9A=B0=EC=84=A0=20=EC=9E=85=EB=A0=A5=ED=95=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ticket/views.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ticket/views.py b/ticket/views.py index 70399c6..5bd2264 100644 --- a/ticket/views.py +++ b/ticket/views.py @@ -59,17 +59,17 @@ def issue(request, global_id): 164: 'LibreOffice with python', 165: '파이썬 3대장', 166: '', - 167: '', - 168: '', + 167: 'Music & DeepLearning', + 168: '크롤링으로 첫 코딩 하기', 169: 'Pytest', - 170: '', + 170: 'DNLP using Scikit-Learn/Keras', 171: 'Data Science with Python', 172: 'Django in Beanstalk', - 173: '', - 174: '', + 173: '딥러닝 인공지능 기술', + 174: 'aiohttp로 채팅 웹사이트 만들기', 175: 'Geopandas', 176: 'cliff', - 177: '', + 177: 'Python Debugging', 178: 'GluonNLP', } From 9ea1b948b4ebfa7f419b505a17f50ca61297fd1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=92=E1=85=AA=E1=86=AB?= Date: Fri, 9 Aug 2019 22:48:20 +0900 Subject: [PATCH 26/35] =?UTF-8?q?=EB=8B=A8=EC=B2=B4=20=ED=8B=B0=EC=BC=93?= =?UTF-8?q?=EB=8F=84=20=EB=AC=B8=EA=B5=AC=EA=B0=80=20=ED=91=9C=EC=8B=9C?= =?UTF-8?q?=EB=90=98=EB=8F=84=EB=A1=9D=20=EC=B6=94=EA=B0=80=ED=95=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ticket/views.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ticket/views.py b/ticket/views.py index 5bd2264..7d231fb 100644 --- a/ticket/views.py +++ b/ticket/views.py @@ -73,10 +73,10 @@ def issue(request, global_id): 178: 'GluonNLP', } - if ticket.product.type == TicketProduct.TYPE_TUTORIAL: - product = tutorial_keys[ticket.product.tutorial_set.first().id] - elif ticket.product.type == TicketProduct.TYPE_CONFERENCE: + if ticket.product.type in (TicketProduct.TYPE_CONFERENCE, TicketProduct.TYPE_GROUP_CONFERENCE): product = 'PYCON KOREA 2019' + elif ticket.product.type == TicketProduct.TYPE_TUTORIAL: + product = tutorial_keys[ticket.product.tutorial_set.first().id] else: product = '' From fbb2aa81912f7f1facf9539e28a5ca9210cb7641 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=92=E1=85=AA=E1=86=AB?= Date: Fri, 9 Aug 2019 22:48:48 +0900 Subject: [PATCH 27/35] =?UTF-8?q?=ED=8A=9C=ED=86=A0=EB=A6=AC=EC=96=BC=20?= =?UTF-8?q?=EC=95=88=EB=82=B4=EC=99=80=20=EC=9D=B4=EB=A6=84=EC=9D=98=20?= =?UTF-8?q?=EC=A4=91=EA=B0=84=20=EB=A7=88=EC=A7=84=EC=9D=84=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=ED=95=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ticket/templates/issue.html | 1 + 1 file changed, 1 insertion(+) diff --git a/ticket/templates/issue.html b/ticket/templates/issue.html index f6e0fde..f9f5c36 100644 --- a/ticket/templates/issue.html +++ b/ticket/templates/issue.html @@ -103,6 +103,7 @@
{{ product }} +
{{ profile.name }} {{ profile.organization }}
From c2ab5ef56763bdb0eee914e5bbe7d2f7d427cfbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=92=E1=85=AA=E1=86=AB?= Date: Fri, 9 Aug 2019 22:49:00 +0900 Subject: [PATCH 28/35] =?UTF-8?q?=EA=B8=B4=20=EC=98=81=EB=AC=B8=EB=8F=84?= =?UTF-8?q?=20=EC=A2=80=20=EB=8D=94=20=EC=9E=98=20=ED=91=9C=EC=8B=9C?= =?UTF-8?q?=EB=90=98=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ticket/templates/issue.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ticket/templates/issue.html b/ticket/templates/issue.html index f9f5c36..d7e4c8a 100644 --- a/ticket/templates/issue.html +++ b/ticket/templates/issue.html @@ -293,7 +293,7 @@ $(document).ready( function () { $('.name').quickfit({ - min: 50, + min: 30, max: 100, width: 283, }); From 2c2fad3bc9e18310e023ba6c1f587927786b4b36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=92=E1=85=AA=E1=86=AB?= Date: Fri, 9 Aug 2019 23:28:54 +0900 Subject: [PATCH 29/35] =?UTF-8?q?=EB=B0=9C=EA=B6=8C=EC=B2=98=EB=A6=AC=20ht?= =?UTF-8?q?ml=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=9A=B0=EC=84=A0=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ticket/templates/issue.html | 31 +++++++++++++++++++++++-------- ticket/views.py | 5 +++++ 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/ticket/templates/issue.html b/ticket/templates/issue.html index d7e4c8a..b17bf15 100644 --- a/ticket/templates/issue.html +++ b/ticket/templates/issue.html @@ -82,20 +82,17 @@
- {% if ticket.product.type != 'C' %} -

{{ ticket.product.name }}

- {% endif %} -

{{ profile.name }}님

-

{{ profile.organization }}

-

{% for message in additional_message %} {{ message }} {% endfor %}

- {{ csrf }} - +
+ {% csrf_token %} +
발권 대기중
+ +
@@ -299,8 +296,26 @@ }); $('#ticket_issue').click(function(){ window.print(); + issueTicketConfirm(); }); }); + +function issueTicketConfirm() { + let csrftoken = $('#issue_form input[name=csrfmiddlewaretoken]').attr("value"); + + $.ajax("{% url 'ticket_issue' global_id %}", { + method: 'POST', + beforeSend: function(xhr) { + xhr.setRequestHeader("X-CSRFToken", csrftoken); + }, + success: function(data) { + $('#issue_status').val('발권처리 기록 되었습니다.'); + }, + error: function(data) { + $('#issue_status').val('발권처리 기록에 실패 하였습니다.'); + } + }); +} diff --git a/ticket/views.py b/ticket/views.py index 7d231fb..43b11e4 100644 --- a/ticket/views.py +++ b/ticket/views.py @@ -1,4 +1,5 @@ from django.contrib.auth.decorators import user_passes_test +from django.http import HttpResponse from django.shortcuts import render, get_object_or_404 from graphql_relay import from_global_id @@ -21,6 +22,9 @@ def issue(request, global_id): ticket = get_object_or_404(Ticket, id=pk) profile = ticket.owner.profile + if request.method == "POST": + return HttpResponse('') + additional_keys = { 'is_patron': '개인후원 버튼을 전달', 'is_open_reviewer': '오픈리뷰어 버튼을 전달', @@ -81,6 +85,7 @@ def issue(request, global_id): product = '' context = { + 'global_id': global_id, 'profile': profile, 'ticket': ticket, 'product': product, From 1def6078475fcd6013a56cb5efd48edcab1fe162 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=92=E1=85=AA=E1=86=AB?= Date: Fri, 9 Aug 2019 23:57:17 +0900 Subject: [PATCH 30/35] =?UTF-8?q?=ED=8B=B0=EC=BC=93=20=EB=B0=9C=EA=B6=8C?= =?UTF-8?q?=20=ED=98=84=ED=99=A9=EC=9D=84=20=EC=A1=B0=ED=9A=8C=ED=95=A9?= =?UTF-8?q?=EB=8B=88=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ticket/admin.py | 16 +++++++++++++--- ticket/models.py | 12 ++++++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/ticket/admin.py b/ticket/admin.py index 274b130..91973eb 100644 --- a/ticket/admin.py +++ b/ticket/admin.py @@ -5,6 +5,8 @@ from django.urls import reverse from django.utils import timezone from django.utils.formats import localize +from django.utils.html import format_html_join, format_html +from django.utils.safestring import mark_safe from django.utils.translation import ugettext_lazy as _ from graphql_relay import from_global_id, to_global_id from iamport import Iamport @@ -13,10 +15,8 @@ from import_export.admin import ImportExportModelAdmin from api.models.profile import Profile -from ticket.models import Ticket, TicketProduct, TicketForRegistration +from ticket.models import Ticket, TicketProduct, TicketForRegistration, Registration from ticket.schemas import create_iamport -from django.utils.html import format_html_join, format_html -from django.utils.safestring import mark_safe class TicketProductResource(resources.ModelResource): @@ -166,3 +166,13 @@ def get_search_results(self, request, queryset, search_term): admin.site.register(TicketForRegistration, TicketForRegistrationAdmin) + + +class RegistrationAdmin(admin.ModelAdmin): + list_display = ('owner_name', 'owner_email', 'registered_at') + list_filter = ('ticket__product__type',) + search_fields = ('ticket__owner__profile__email', + 'ticket__owner__profile__name_ko', 'ticket__owner__profile__name_en',) + + +admin.site.register(Registration, RegistrationAdmin) diff --git a/ticket/models.py b/ticket/models.py index d36ba33..eed08c6 100644 --- a/ticket/models.py +++ b/ticket/models.py @@ -201,6 +201,18 @@ class Registration(models.Model): ticket = models.ForeignKey(Ticket, on_delete=models.CASCADE) registered_at = models.DateTimeField(null=True, blank=True) + @property + def owner_name(self): + if self.ticket.owner: + return self.ticket.owner.profile.name + return '' + + @property + def owner_email(self): + if self.ticket.owner: + return self.ticket.owner.profile.email + return '' + class TicketForRegistration(Ticket): class Meta: From ebc39dc51477978658c536a7f83e249d0a293462 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=92=E1=85=AA=E1=86=AB?= Date: Sat, 10 Aug 2019 00:01:52 +0900 Subject: [PATCH 31/35] =?UTF-8?q?=EB=B6=88=ED=95=84=EC=9A=94=20=EB=B0=95?= =?UTF-8?q?=EC=8A=A4=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ticket/templates/issue.html | 3 --- 1 file changed, 3 deletions(-) diff --git a/ticket/templates/issue.html b/ticket/templates/issue.html index b17bf15..3792bcb 100644 --- a/ticket/templates/issue.html +++ b/ticket/templates/issue.html @@ -21,9 +21,6 @@ } .name-box { position:absolute; - background-color: antiquewhite; - border-style: solid; - border-width: 1px; top: 72mm; left: 51mm; width: 109mm; From e65f6025ca659cbf91ff99da3bcb26a8dd5730c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=92=E1=85=AA=E1=86=AB?= Date: Sat, 10 Aug 2019 00:10:32 +0900 Subject: [PATCH 32/35] =?UTF-8?q?=EB=B0=9C=EA=B6=8C=20=EA=B8=B0=EB=A1=9D?= =?UTF-8?q?=EC=9D=84=20=EB=82=A8=EA=B8=B4=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ticket/models.py | 7 +++++++ ticket/templates/issue.html | 7 ++++--- ticket/views.py | 6 +++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/ticket/models.py b/ticket/models.py index eed08c6..3ce74ae 100644 --- a/ticket/models.py +++ b/ticket/models.py @@ -196,6 +196,13 @@ def owner_organization(self): return self.owner.profile.organization return '' + def set_issue(self): + registration, created = Registration.objects.update_or_create( + ticket=self, registered_at=timezone.now() + ) + + return registration + class Registration(models.Model): ticket = models.ForeignKey(Ticket, on_delete=models.CASCADE) diff --git a/ticket/templates/issue.html b/ticket/templates/issue.html index 3792bcb..4a1cdeb 100644 --- a/ticket/templates/issue.html +++ b/ticket/templates/issue.html @@ -291,7 +291,8 @@ max: 100, width: 283, }); - $('#ticket_issue').click(function(){ + $('#ticket_issue').click(function(e){ + e.preventDefault(); window.print(); issueTicketConfirm(); }); @@ -306,10 +307,10 @@ xhr.setRequestHeader("X-CSRFToken", csrftoken); }, success: function(data) { - $('#issue_status').val('발권처리 기록 되었습니다.'); + $('#issue_status').text('발권처리 기록 되었습니다.'); }, error: function(data) { - $('#issue_status').val('발권처리 기록에 실패 하였습니다.'); + $('#issue_status').text('발권처리 기록에 실패 하였습니다.'); } }); } diff --git a/ticket/views.py b/ticket/views.py index 43b11e4..8fb5723 100644 --- a/ticket/views.py +++ b/ticket/views.py @@ -23,7 +23,11 @@ def issue(request, global_id): profile = ticket.owner.profile if request.method == "POST": - return HttpResponse('') + try: + ticket.set_issue() + return HttpResponse('') + except Exception as e: + return HttpResponse(status=401) additional_keys = { 'is_patron': '개인후원 버튼을 전달', From cde86cfd2aae5a8e11d3f85d5b45736c1463374b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=92=E1=85=AA=E1=86=AB?= Date: Wed, 14 Aug 2019 03:30:03 +0900 Subject: [PATCH 33/35] =?UTF-8?q?=EC=82=AC=EC=9D=B4=EC=A6=88=20=EC=A0=84?= =?UTF-8?q?=EB=8B=AC=20=EA=B4=80=EB=A0=A8=20=EB=82=B4=EC=9A=A9=20=ED=91=9C?= =?UTF-8?q?=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ticket/templates/issue.html | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ticket/templates/issue.html b/ticket/templates/issue.html index 69642e5..9e124fd 100644 --- a/ticket/templates/issue.html +++ b/ticket/templates/issue.html @@ -19,10 +19,13 @@ position: relative; top: 3mm; } -.gift-box .warning { +.gift-warning { + position:absolute; + top: 30mm; + left: 55mm; + width: 80mm; + height: 15mm; font-size: 3mm; - position: relative; - top: 3mm; } .name-box { position:absolute; @@ -99,7 +102,9 @@
{{ tshirtsize }}
- 티셔츠 사이즈는 빠른 전달을 위한 참고용입니다.
상황에 따라 입력한 사이즈 제공이 어려울 수 있습니다
+
+
+ 표시된 티셔츠 사이즈는 빠른 전달을 위한 참고용입니다.
현장 상황에 따라 표시된 사이즈 제공이 어려울 수 있습니다.
{{ product }} From 254aa990423bb19f6d108f989d06bcc1cfaa91aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=92=E1=85=AA=E1=86=AB?= Date: Wed, 14 Aug 2019 03:36:47 +0900 Subject: [PATCH 34/35] =?UTF-8?q?=EC=B6=9C=EB=A0=A5=20=EB=82=B4=EC=9A=A9?= =?UTF-8?q?=EC=9D=B4=20=EC=97=86=EC=96=B4=EB=8F=84=20=EC=98=81=EC=97=AD?= =?UTF-8?q?=EC=9D=84=20=EB=B3=B4=EC=A1=B4=ED=95=98=EA=B8=B0=20=EC=9C=84?= =?UTF-8?q?=ED=95=9C=20=EC=9E=91=EC=97=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ticket/templates/issue.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ticket/templates/issue.html b/ticket/templates/issue.html index 9e124fd..edb8447 100644 --- a/ticket/templates/issue.html +++ b/ticket/templates/issue.html @@ -107,7 +107,7 @@ 표시된 티셔츠 사이즈는 빠른 전달을 위한 참고용입니다.
현장 상황에 따라 표시된 사이즈 제공이 어려울 수 있습니다.
- {{ product }} + {{ product|default:" " }}
{{ profile.name }} {{ profile.organization }} From 66ed28d22de601cdb28a493a8fb49d9c0438082a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=92=E1=85=AA=E1=86=AB?= Date: Wed, 14 Aug 2019 03:58:18 +0900 Subject: [PATCH 35/35] =?UTF-8?q?=EC=82=AC=EC=9A=A9=EC=9D=84=20=EB=AA=BB?= =?UTF-8?q?=ED=95=98=EB=8A=94=20=EA=B5=90=ED=99=98=EA=B6=8C=EC=9D=B4=20?= =?UTF-8?q?=EC=9E=98=EB=AA=BB=20=EC=A0=84=EB=8B=AC=EB=90=98=EB=8A=94=20?= =?UTF-8?q?=EA=B2=83=EC=9D=84=20=EB=B0=A9=EC=A7=80=ED=95=98=EA=B8=B0=20?= =?UTF-8?q?=EC=9C=84=ED=95=B4=EC=84=9C=20=EB=AA=85=ED=99=95=ED=95=98?= =?UTF-8?q?=EA=B2=8C=20=EC=95=88=EB=82=B4=EB=A5=BC=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=ED=95=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ticket/templates/issue.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ticket/templates/issue.html b/ticket/templates/issue.html index edb8447..cb315ca 100644 --- a/ticket/templates/issue.html +++ b/ticket/templates/issue.html @@ -104,7 +104,11 @@ {{ tshirtsize }}
- 표시된 티셔츠 사이즈는 빠른 전달을 위한 참고용입니다.
현장 상황에 따라 표시된 사이즈 제공이 어려울 수 있습니다.
+ {% if tshirtsize == 'XXXX' %} + 본 교환권은 사용이 불가능합니다. + {% else %} + 표시된 티셔츠 사이즈는 빠른 전달을 위한 참고용입니다.
현장 상황에 따라 표시된 사이즈 제공이 어려울 수 있습니다.
+ {% endif %}
{{ product|default:" " }}