add province api
This commit is contained in:
parent
099b99fd7a
commit
42b4bbe740
3 changed files with 1347 additions and 1 deletions
1336
apps/users/provinces_and_cities.py
Normal file
1336
apps/users/provinces_and_cities.py
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -6,10 +6,12 @@ from django.utils import timezone
|
|||
from oauth2_provider.contrib.rest_framework import IsAuthenticatedOrTokenHasScope
|
||||
from rest_framework import generics, status
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.views import APIView
|
||||
|
||||
from apps.gooyal_oauth2.rest_framework import IsAuthenticatedOrTokenMatchesOASRequirements
|
||||
from apps.users.forms import OTPAuthenticationForm
|
||||
from apps.users.models import User
|
||||
from apps.users.provinces_and_cities import State
|
||||
from apps.users.serializers import PublicUserSerializer, AccountSerializer, RequestOTPSerializer, \
|
||||
ChangePasswordSerializer
|
||||
|
||||
|
|
@ -97,3 +99,10 @@ class OTPLoginView(LoginView):
|
|||
Display the login form and handle the login action.
|
||||
"""
|
||||
form_class = OTPAuthenticationForm
|
||||
|
||||
|
||||
class ProvinceApiView(APIView):
|
||||
permission_classes = [permissions.AllowAny]
|
||||
|
||||
def get(self, request):
|
||||
return Response(State().province_list())
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ from django.contrib import admin
|
|||
from apps.transactions.views import TransactionList, TransactionDetail, TransactionPay, TransactionReceipt, \
|
||||
WithdrawVerify, WithdrawSubmit, DepositSubmit, DepositVerify
|
||||
from apps.users.views import UserListView, UserDetailView, AccountView, RequestOTPView, ChangePasswordView, \
|
||||
OTPLoginView, home
|
||||
OTPLoginView, home, ProvinceApiView
|
||||
from django.contrib.auth import urls as auth_urls
|
||||
|
||||
# Setup the URLs and include login URLs for the browsable API.
|
||||
|
|
@ -45,6 +45,7 @@ urlpatterns = [
|
|||
path('users/<uuid>/', UserDetailView.as_view(), name='user_detail'),
|
||||
path('request_otp/', RequestOTPView.as_view(), name='register'),
|
||||
path('change_password/', ChangePasswordView.as_view(), name='change_password'),
|
||||
path('province', ProvinceApiView.as_view(), name='province'),
|
||||
|
||||
path('transactions/', TransactionList.as_view(), name='transactions'),
|
||||
path('transactions/<uuid>', TransactionDetail.as_view(), name='transaction_detail'),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue