Kumi
1e1b590803
Set up the initial Django project structure including custom user model, domain management app, and associated configurations. Added models for Domain, DNSRecord, LeaseAgreement, Payment, and Registrar. Configured serializers, views, and URLs for basic operations. Implemented JWT-based authentication and login via email link. Included necessary admin configurations and migrations. - Added .gitignore to exclude unnecessary files. - Added .vscode/launch.json for VSCode debug configuration. - Added LICENSE file with MIT license. - Created README.md and initialized project directories. - Configured settings for different environments and database support. - Configured basic Celery integration and REST framework settings.
82 lines
2.7 KiB
Python
82 lines
2.7 KiB
Python
from django.db import models
|
|
from django.contrib.auth import get_user_model
|
|
|
|
User = get_user_model()
|
|
|
|
|
|
class Domain(models.Model):
|
|
STATUS_CHOICES = [
|
|
("available", "Available"),
|
|
("parked", "Parked"),
|
|
("leased", "Leased"),
|
|
("for_sale", "For Sale"),
|
|
]
|
|
|
|
name = models.CharField(max_length=255, unique=True)
|
|
status = models.CharField(max_length=20, choices=STATUS_CHOICES)
|
|
owner = models.ForeignKey(User, on_delete=models.CASCADE, related_name="domains")
|
|
registration_date = models.DateField()
|
|
expiration_date = models.DateField()
|
|
price = models.DecimalField(max_digits=10, decimal_places=2, null=True, blank=True)
|
|
description = models.TextField(blank=True, null=True)
|
|
accept_offers = models.BooleanField(default=False)
|
|
buy_now_price = models.DecimalField(
|
|
max_digits=10, decimal_places=2, null=True, blank=True
|
|
)
|
|
additional_info_request = models.TextField(blank=True, null=True)
|
|
|
|
def __str__(self):
|
|
return self.name
|
|
|
|
|
|
class DNSRecord(models.Model):
|
|
RECORD_TYPE_CHOICES = [
|
|
("A", "A"),
|
|
("CNAME", "CNAME"),
|
|
("MX", "MX"),
|
|
# TODO: Add other record types as needed
|
|
]
|
|
|
|
domain = models.ForeignKey(
|
|
Domain, on_delete=models.CASCADE, related_name="dns_records"
|
|
)
|
|
record_type = models.CharField(max_length=10, choices=RECORD_TYPE_CHOICES)
|
|
record_value = models.CharField(max_length=255)
|
|
ttl = models.IntegerField(default=3600)
|
|
priority = models.IntegerField(null=True, blank=True)
|
|
|
|
|
|
class LeaseAgreement(models.Model):
|
|
STATUS_CHOICES = [
|
|
("active", "Active"),
|
|
("expired", "Expired"),
|
|
("terminated", "Terminated"),
|
|
]
|
|
|
|
domain = models.ForeignKey(
|
|
Domain, on_delete=models.CASCADE, related_name="lease_agreements"
|
|
)
|
|
lessee = models.ForeignKey(
|
|
get_user_model(), on_delete=models.CASCADE, related_name="leases"
|
|
)
|
|
start_date = models.DateField()
|
|
end_date = models.DateField()
|
|
payment_terms = models.CharField(max_length=255)
|
|
status = models.CharField(max_length=20, choices=STATUS_CHOICES)
|
|
|
|
|
|
class Payment(models.Model):
|
|
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name="payments")
|
|
amount = models.DecimalField(max_digits=10, decimal_places=2)
|
|
payment_date = models.DateTimeField(auto_now_add=True)
|
|
payment_method = models.CharField(max_length=50)
|
|
transaction_id = models.CharField(max_length=255)
|
|
status = models.CharField(max_length=20)
|
|
|
|
|
|
class Registrar(models.Model):
|
|
name = models.CharField(max_length=255)
|
|
api_key = models.CharField(max_length=255)
|
|
api_secret = models.CharField(max_length=255)
|
|
contact_info = models.TextField()
|
|
supported_tlds = models.TextField()
|