from django.db import models
from django.conf import settings
from django.urls import reverse


class IPManagementRecord(models.Model):
    network_nm = models.CharField(max_length=100)  # NETWORK_NM
    ip_addrs = models.CharField(max_length=50)     # IP_ADDRS
    svr_nm = models.CharField(max_length=100)      # SVR_NM
    contents = models.TextField(blank=True, null=True) # desc -> contents
    remark = models.TextField(blank=True, null=True) # REMARK
    created_at = models.DateTimeField(auto_now_add=True)  # 생성 시간 자동 기록
    updated_at = models.DateTimeField(auto_now=True)      # 수정 시간 자동 기록

    author = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, on_delete=models.CASCADE)

    def __str__(self):
        return f'{self.network_nm} {self.ip_addrs} {self.svr_nm} {self.contents}'