/market-place

common-market-place

Primary LanguagePython

duplicate_agent_numbers = SubCategory.objects.values('subcategory_name').annotate(count=Count('subcategory_name')).filter(count__gt=1)

Loop through each duplicate agent number and delete the duplicate records

for subcategory_name in duplicate_agent_numbers: SubCategory.objects.filter(subcategory_name=subcategory_name['subcategory_name']).delete()

To run project in local create a local_settings.py file inside mwb folder

Add your local variables

from datetime import timedelta

ALLOWED_HOSTS = ['*'] DEBUG = True

SECURITY WARNING: keep the secret key used in production secret!

SECRET_KEY = ''

SIMPLE_JWT = { 'ACCESS_TOKEN_LIFETIME': timedelta(days=90), 'REFRESH_TOKEN_LIFETIME': timedelta(days=95), 'ROTATE_REFRESH_TOKENS': False, 'BLACKLIST_AFTER_ROTATION': False, 'UPDATE_LAST_LOGIN': False,

'ALGORITHM': 'HS256',
'SIGNING_KEY': SECRET_KEY,
'VERIFYING_KEY': None,
'AUDIENCE': None,
'ISSUER': None,
'JWK_URL': None,
'LEEWAY': 0,

'AUTH_HEADER_TYPES': ('Bearer',),
'AUTH_HEADER_NAME': 'HTTP_AUTHORIZATION',
'USER_ID_FIELD': 'id',
'USER_ID_CLAIM': 'user_id',
'USER_AUTHENTICATION_RULE': 'rest_framework_simplejwt.authentication.default_user_authentication_rule',

'AUTH_TOKEN_CLASSES': ('rest_framework_simplejwt.tokens.AccessToken',),
'TOKEN_TYPE_CLAIM': 'token_type',
'TOKEN_USER_CLASS': 'rest_framework_simplejwt.models.TokenUser',

'JTI_CLAIM': 'jti',

'SLIDING_TOKEN_REFRESH_EXP_CLAIM': 'refresh_exp',
'SLIDING_TOKEN_LIFETIME': timedelta(days=90),
'SLIDING_TOKEN_REFRESH_LIFETIME': timedelta(days=95),

}

DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': '', 'USER': '', 'PASSWORD': '', 'HOST': '', 'PORT': '', } }