Event Implement
This commit is contained in:
parent
796a71f9a5
commit
a5b64511f6
|
|
@ -0,0 +1,17 @@
|
||||||
|
from rest_framework import serializers
|
||||||
|
from BaseBillet.models import Event
|
||||||
|
|
||||||
|
class EventSerializer(serializers.HyperlinkedModelSerializer):
|
||||||
|
class Meta:
|
||||||
|
model = Event
|
||||||
|
fields = [
|
||||||
|
'name',
|
||||||
|
'short_description',
|
||||||
|
'long_description',
|
||||||
|
'datetime',
|
||||||
|
# 'billets',
|
||||||
|
# 'articles',
|
||||||
|
'img',
|
||||||
|
# 'reservations',
|
||||||
|
# 'complet',
|
||||||
|
]
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
from django.urls import include, path, re_path
|
||||||
|
|
||||||
|
# from BaseBillet import views as base_view
|
||||||
|
from ApiBillet import views as api_view
|
||||||
|
from rest_framework import routers
|
||||||
|
|
||||||
|
router = routers.DefaultRouter()
|
||||||
|
router.register(r'events', api_view.EventViewSet)
|
||||||
|
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path('', include(router.urls)),
|
||||||
|
]
|
||||||
|
|
@ -1,7 +1,11 @@
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
|
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
|
from ApiBillet.serializers import EventSerializer
|
||||||
from Customers.models import Client, Domain
|
from Customers.models import Client, Domain
|
||||||
|
from BaseBillet.models import Event
|
||||||
|
from rest_framework import viewsets, permissions
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
def new_tenants(schema_name):
|
def new_tenants(schema_name):
|
||||||
|
|
@ -18,3 +22,14 @@ def new_tenants(schema_name):
|
||||||
)
|
)
|
||||||
|
|
||||||
return tenant, tenant_domain
|
return tenant, tenant_domain
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class EventViewSet(viewsets.ModelViewSet):
|
||||||
|
"""
|
||||||
|
API endpoint that allows users to be viewed or edited.
|
||||||
|
"""
|
||||||
|
queryset = Event.objects.all().order_by('-datetime')
|
||||||
|
serializer_class = EventSerializer
|
||||||
|
permission_classes = [permissions.AllowAny]
|
||||||
|
|
|
||||||
|
|
@ -153,6 +153,8 @@ REST_FRAMEWORK = {
|
||||||
"rest_framework_simplejwt.authentication.JWTAuthentication",
|
"rest_framework_simplejwt.authentication.JWTAuthentication",
|
||||||
"rest_framework.authentication.TokenAuthentication",
|
"rest_framework.authentication.TokenAuthentication",
|
||||||
),
|
),
|
||||||
|
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
|
||||||
|
'PAGE_SIZE': 10
|
||||||
}
|
}
|
||||||
|
|
||||||
SIMPLE_JWT = {
|
SIMPLE_JWT = {
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,9 @@ urlpatterns = [
|
||||||
|
|
||||||
re_path(r'^user/', include('AuthBillet.urls')),
|
re_path(r'^user/', include('AuthBillet.urls')),
|
||||||
|
|
||||||
|
re_path(r'api/', include('ApiBillet.urls')),
|
||||||
|
|
||||||
|
|
||||||
path('', include('BaseBillet.urls')),
|
path('', include('BaseBillet.urls')),
|
||||||
|
|
||||||
# path('admin/', admin.site.urls, name="public_admin_url"),
|
# path('admin/', admin.site.urls, name="public_admin_url"),
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ Enjoy !
|
||||||
Jonas TURBEAUX & Nicolas DIJOUX
|
Jonas TURBEAUX & Nicolas DIJOUX
|
||||||
pour Peaks2Prod & 3Peaks Production.
|
pour Peaks2Prod & 3Peaks Production.
|
||||||
|
|
||||||
Free for personal and commercial use under the MIT 3.0 license
|
Free for personal and commercial use under the AGPL-3.0 licence.
|
||||||
|
|
||||||
## Graphisme :
|
## Graphisme :
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue