partition tickets by event
This commit is contained in:
parent
2c609427ec
commit
227fd4292c
3 changed files with 9 additions and 9 deletions
|
@ -1,4 +1,4 @@
|
|||
from django.urls import path
|
||||
from django.urls import re_path
|
||||
from django.contrib.auth.decorators import permission_required
|
||||
from rest_framework import routers, viewsets
|
||||
from rest_framework.decorators import api_view, permission_classes
|
||||
|
@ -99,8 +99,8 @@ router.register(r'boxes', ContainerViewSet, basename='boxes')
|
|||
router.register(r'box', ContainerViewSet, basename='boxes')
|
||||
|
||||
urlpatterns = router.urls + [
|
||||
path('<event_slug>/items/', item),
|
||||
path('<event_slug>/items/<query>/', search_items),
|
||||
path('<event_slug>/item/', item),
|
||||
path('<event_slug>/item/<id>/', item_by_id),
|
||||
re_path(r'^(?P<event_slug>[\w-]+)/items/$', item, name='item'),
|
||||
re_path(r'^(?P<event_slug>[\w-]+)/items/(?P<query>[-A-Za-z0-9+/]*={0,3})/$', search_items, name='search_items'),
|
||||
re_path(r'^(?P<event_slug>[\w-]+)/item/$', item, name='item'),
|
||||
re_path(r'^(?P<event_slug>[\w-]+)/item/(?P<id>\d+)/$', item_by_id, name='item_by_id'),
|
||||
]
|
||||
|
|
|
@ -56,7 +56,7 @@ def reply(request, pk):
|
|||
@api_view(['POST'])
|
||||
@permission_classes([IsAuthenticated])
|
||||
@permission_required('tickets.add_issuethread_manual', raise_exception=True)
|
||||
def manual_ticket(request):
|
||||
def manual_ticket(request, event_slug):
|
||||
if 'name' not in request.data:
|
||||
return Response({'status': 'error', 'message': 'missing name'}, status=status.HTTP_400_BAD_REQUEST)
|
||||
if 'sender' not in request.data:
|
||||
|
@ -122,8 +122,8 @@ router.register(r'tickets', IssueViewSet, basename='issues')
|
|||
router.register(r'shipping_vouchers', ShippingVoucherViewSet, basename='shipping_vouchers')
|
||||
|
||||
urlpatterns = ([
|
||||
re_path(r'tickets/states/$', get_available_states, name='get_available_states'),
|
||||
re_path(r'^tickets/(?P<pk>\d+)/reply/$', reply, name='reply'),
|
||||
re_path(r'^tickets/(?P<pk>\d+)/comment/$', add_comment, name='add_comment'),
|
||||
re_path(r'^tickets/manual/$', manual_ticket, name='manual_ticket'),
|
||||
re_path(r'^tickets/states/$', get_available_states, name='get_available_states'),
|
||||
re_path(r'^(?P<event_slug>[\w-]+)/tickets/manual/$', manual_ticket, name='manual_ticket'),
|
||||
] + router.urls)
|
||||
|
|
|
@ -230,7 +230,7 @@ class IssueApiTest(TestCase):
|
|||
self.assertEqual(file2.hash, response.json()[0]['timeline'][1]['attachments'][1]['hash'])
|
||||
|
||||
def test_manual_creation(self):
|
||||
response = self.client.post('/api/2/tickets/manual/',
|
||||
response = self.client.post('/api/2/evt/tickets/manual/',
|
||||
{'name': 'test issue', 'sender': 'test', 'recipient': 'test', 'body': 'test'},
|
||||
content_type='application/json')
|
||||
self.assertEqual(response.status_code, 201)
|
||||
|
|
Loading…
Reference in a new issue