The new updates of partners and user

Made-with: Cursor
This commit is contained in:
Vivek P Prakash
2026-03-15 00:29:17 +05:30
parent 88b3aafb0b
commit c04395afc9
65 changed files with 5242 additions and 341 deletions

0
partner/__init__.py Normal file
View File

24
partner/admin.py Normal file
View File

@@ -0,0 +1,24 @@
from django.contrib import admin
from .models import Partner
@admin.register(Partner)
class PartnerAdmin(admin.ModelAdmin):
list_display = ('name', 'partner_type', 'primary_contact_person_name', 'primary_contact_person_email', 'is_kyc_compliant', 'kyc_compliance_status')
list_filter = ('partner_type', 'is_kyc_compliant', 'kyc_compliance_status')
search_fields = ('name', 'primary_contact_person_name', 'primary_contact_person_email', 'primary_contact_person_phone')
fieldsets = (
('Basic Information', {
'fields': ('name', 'partner_type')
}),
('Contact Information', {
'fields': ('primary_contact_person_name', 'primary_contact_person_email', 'primary_contact_person_phone', 'website_url')
}),
('Address', {
'fields': ('address', 'city', 'state', 'country', 'pincode', 'latitude', 'longitude')
}),
('KYC Compliance', {
'fields': ('is_kyc_compliant', 'kyc_compliance_status', 'kyc_compliance_reason', 'kyc_compliance_document_type',
'kyc_compliance_document_other_type', 'kyc_compliance_document_file', 'kyc_compliance_document_number')
}),
)

1118
partner/api.py Normal file

File diff suppressed because it is too large Load Diff

6
partner/apps.py Normal file
View File

@@ -0,0 +1,6 @@
from django.apps import AppConfig
class PartnerConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'partner'

View File

@@ -0,0 +1,41 @@
# Generated by Django 4.2.27 on 2026-03-13 16:55
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Partner',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=250)),
('partner_type', models.CharField(choices=[('venue', 'Venue'), ('promoter', 'Promoter'), ('sponsor', 'Sponsor'), ('vendor', 'Vendor'), ('affiliate', 'Affiliate'), ('other', 'Other')], max_length=250)),
('primary_contact_person_name', models.CharField(max_length=250)),
('primary_contact_person_email', models.EmailField(max_length=254)),
('primary_contact_person_phone', models.CharField(max_length=15)),
('status', models.CharField(choices=[('active', 'Active'), ('inactive', 'Inactive'), ('pending', 'Pending'), ('suspended', 'Suspended'), ('deleted', 'Deleted'), ('archived', 'Archived')], default='active', max_length=250)),
('address', models.TextField(blank=True, null=True)),
('city', models.CharField(blank=True, max_length=250, null=True)),
('state', models.CharField(blank=True, max_length=250, null=True)),
('country', models.CharField(blank=True, max_length=250, null=True)),
('website_url', models.URLField(blank=True, null=True)),
('pincode', models.CharField(blank=True, max_length=10, null=True)),
('latitude', models.DecimalField(blank=True, decimal_places=6, max_digits=9, null=True)),
('longitude', models.DecimalField(blank=True, decimal_places=6, max_digits=9, null=True)),
('is_kyc_compliant', models.BooleanField(default=False)),
('kyc_compliance_status', models.CharField(choices=[('pending', 'Pending'), ('approved', 'Approved'), ('rejected', 'Rejected'), ('high_risk', 'High Risk'), ('low_risk', 'Low Risk'), ('medium_risk', 'Medium Risk')], default='pending', max_length=250)),
('kyc_compliance_reason', models.TextField(blank=True, null=True)),
('kyc_compliance_document_type', models.CharField(blank=True, choices=[('aadhaar', 'Aadhaar'), ('pan', 'PAN'), ('driving_license', 'Driving License'), ('voter_id', 'Voter ID'), ('passport', 'Passport'), ('other', 'Other')], max_length=250, null=True)),
('kyc_compliance_document_other_type', models.CharField(blank=True, max_length=250, null=True)),
('kyc_compliance_document_file', models.FileField(blank=True, null=True, upload_to='kyc_documents/')),
('kyc_compliance_document_number', models.CharField(blank=True, max_length=250, null=True)),
],
),
]

View File

69
partner/models.py Normal file
View File

@@ -0,0 +1,69 @@
from django.db import models
PARTNER_TYPE_CHOICES = (
('venue', 'Venue'),
('promoter', 'Promoter'),
('sponsor', 'Sponsor'),
('vendor', 'Vendor'),
('affiliate', 'Affiliate'),
('other', 'Other'),
)
KYC_DOCUMENT_TYPE_CHOICES = (
('aadhaar', 'Aadhaar'),
('pan', 'PAN'),
('driving_license', 'Driving License'),
('voter_id', 'Voter ID'),
('passport', 'Passport'),
('other', 'Other'),
)
KYC_COMPLIANCE_STATUS_CHOICES = (
('pending', 'Pending'),
('approved', 'Approved'),
('rejected', 'Rejected'),
('high_risk', 'High Risk'),
('low_risk', 'Low Risk'),
('medium_risk', 'Medium Risk'),
)
STATUS_CHOICES = (
('active', 'Active'),
('inactive', 'Inactive'),
('pending', 'Pending'),
('suspended', 'Suspended'),
('deleted', 'Deleted'),
('archived', 'Archived'),
)
class Partner(models.Model):
name = models.CharField(max_length=250)
partner_type = models.CharField(max_length=250, choices=PARTNER_TYPE_CHOICES)
primary_contact_person_name = models.CharField(max_length=250)
primary_contact_person_email = models.EmailField()
primary_contact_person_phone = models.CharField(max_length=15)
status = models.CharField(max_length=250, choices=STATUS_CHOICES, default='active')
address = models.TextField(blank=True, null=True)
city = models.CharField(max_length=250, blank=True, null=True)
state = models.CharField(max_length=250, blank=True, null=True)
country = models.CharField(max_length=250, blank=True, null=True)
website_url = models.URLField(blank=True, null=True)
pincode = models.CharField(max_length=10, blank=True, null=True)
latitude = models.DecimalField(max_digits=9, decimal_places=6, blank=True, null=True)
longitude = models.DecimalField(max_digits=9, decimal_places=6, blank=True, null=True)
is_kyc_compliant = models.BooleanField(default=False)
kyc_compliance_status = models.CharField(max_length=250, choices=KYC_COMPLIANCE_STATUS_CHOICES, default='pending')
kyc_compliance_reason = models.TextField(blank=True, null=True)
kyc_compliance_document_type = models.CharField(max_length=250, choices=KYC_DOCUMENT_TYPE_CHOICES, blank=True, null=True)
kyc_compliance_document_other_type = models.CharField(max_length=250, blank=True, null=True)
kyc_compliance_document_file = models.FileField(upload_to='kyc_documents/', blank=True, null=True)
kyc_compliance_document_number = models.CharField(max_length=250, blank=True, null=True)
def __str__(self):
return self.name

3
partner/tests.py Normal file
View File

@@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

40
partner/urls.py Normal file
View File

@@ -0,0 +1,40 @@
from django.urls import path
from partner.api import (
PartnerCreateAPI,
PartnerListAPI,
PartnerUpdateAPI,
PartnerDeleteAPI,
PartnerUpdateKYCDocumentsAPI,
PartnerUpdateAddressLocationAPI,
PartnerCreateUserAPI,
PartnerListUsersAPI,
PartnerUpdateUserAPI,
PartnerDeleteUserAPI,
PartnerListAllAPI,
PartnerListKYCCompliantAPI,
PartnerListKYCPendingAPI,
PartnerListHighRiskAPI,
PartnerListJoinedThisWeekAPI,
)
urlpatterns = [
path("create/", PartnerCreateAPI.as_view(), name="partner_create"),
path("list/", PartnerListAPI.as_view(), name="partner_list"),
path("update/", PartnerUpdateAPI.as_view(), name="partner_update"),
path("delete/", PartnerDeleteAPI.as_view(), name="partner_delete"),
path("update-kyc-documents/", PartnerUpdateKYCDocumentsAPI.as_view(), name="partner_update_kyc_documents"),
path("update-address-location/", PartnerUpdateAddressLocationAPI.as_view(), name="partner_update_address_location"),
path("create-user/", PartnerCreateUserAPI.as_view(), name="partner_create_user"),
path("list-users/", PartnerListUsersAPI.as_view(), name="partner_list_users"),
path("update-user/", PartnerUpdateUserAPI.as_view(), name="partner_update_user"),
path("delete-user/", PartnerDeleteUserAPI.as_view(), name="partner_delete_user"),
# Partner List APIs (Filtered by Criteria)
path("list-all/", PartnerListAllAPI.as_view(), name="partner_list_all"),
path("list-kyc-compliant/", PartnerListKYCCompliantAPI.as_view(), name="partner_list_kyc_compliant"),
path("list-kyc-pending/", PartnerListKYCPendingAPI.as_view(), name="partner_list_kyc_pending"),
path("list-high-risk/", PartnerListHighRiskAPI.as_view(), name="partner_list_high_risk"),
path("list-joined-this-week/", PartnerListJoinedThisWeekAPI.as_view(), name="partner_list_joined_this_week"),
]

3
partner/views.py Normal file
View File

@@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.