Add hexa id generator
This commit is contained in:
0
kivi_cars/Generator/__init__.py
Normal file
0
kivi_cars/Generator/__init__.py
Normal file
3
kivi_cars/Generator/admin.py
Normal file
3
kivi_cars/Generator/admin.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
6
kivi_cars/Generator/apps.py
Normal file
6
kivi_cars/Generator/apps.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class GeneratorConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'Generator'
|
||||
0
kivi_cars/Generator/migrations/__init__.py
Normal file
0
kivi_cars/Generator/migrations/__init__.py
Normal file
3
kivi_cars/Generator/models.py
Normal file
3
kivi_cars/Generator/models.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
3
kivi_cars/Generator/tests.py
Normal file
3
kivi_cars/Generator/tests.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
6
kivi_cars/Generator/urls.py
Normal file
6
kivi_cars/Generator/urls.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from django.urls import path
|
||||
from Generator import views
|
||||
|
||||
urlpatterns = [
|
||||
path('', views.HexaGenerator)
|
||||
]
|
||||
12
kivi_cars/Generator/views.py
Normal file
12
kivi_cars/Generator/views.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from rest_framework.decorators import api_view
|
||||
from rest_framework.response import Response
|
||||
import secrets
|
||||
|
||||
# Create your views here.
|
||||
|
||||
@api_view(['GET'])
|
||||
def HexaGenerator(request):
|
||||
if request.method == 'GET':
|
||||
hexa_id = secrets.token_hex(16)
|
||||
return Response({"message": "Search id:", "data": hexa_id})
|
||||
|
||||
Reference in New Issue
Block a user