-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
805 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from django.contrib import admin | ||
|
||
from .models import IP, JPNICUser | ||
|
||
|
||
class TermInlineIPAdmin(admin.TabularInline): | ||
model = IP.jpnic_user.through | ||
extra = 1 | ||
|
||
|
||
class TermInlineJPNICUserAdmin(admin.TabularInline): | ||
model = JPNICUser.ip.through | ||
extra = 1 | ||
|
||
|
||
@admin.register(IP) | ||
class IP(admin.ModelAdmin): | ||
fieldsets = ( | ||
(None, {'fields': ('is_active', 'service',)}), | ||
('ip', {'fields': ('ip_address', 'subnet', 'start_at', 'end_at', 'plan', 'use_case')}), | ||
('Important dates', {'fields': ('created_at', 'updated_at',)}), | ||
) | ||
list_display = ('id', 'is_active', 'service', 'ip_address', 'subnet', 'start_at', 'end_at') | ||
list_filter = ('is_active', 'end_at',) | ||
search_fields = ('ip_address',) | ||
|
||
inlines = (TermInlineIPAdmin,) | ||
|
||
|
||
@admin.register(JPNICUser) | ||
class JPNICUser(admin.ModelAdmin): | ||
fieldsets = ( | ||
(None, {'fields': ('group', 'is_active',)}), | ||
('Common', {'fields': ('hidden', 'handle_type', 'jpnic_handle')}), | ||
('Personal info', {'fields': ( | ||
'name', 'name_jp', 'email', 'org', 'org_en', 'postcode', 'address', 'address_jp', | ||
'dept', 'dept_en', 'title', 'title_en', 'tel', 'fax', 'country')}), | ||
('Important dates', {'fields': ('created_at', 'updated_at',)}), | ||
) | ||
list_display = ('id', 'is_active', 'group', 'jpnic_handle', 'name', 'org') | ||
list_filter = ('is_active', 'group') | ||
search_fields = ('name', 'group', 'org') | ||
|
||
inlines = (TermInlineJPNICUserAdmin,) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class CustomAdmin(AppConfig): | ||
name = "ip" | ||
verbose_name = "IP" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# Generated by Django 5.0.3 on 2024-03-31 08:50 | ||
|
||
import django.utils.timezone | ||
import dsbd.models | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='IP', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('created_at', models.DateTimeField(default=django.utils.timezone.now, verbose_name='作成日')), | ||
('updated_at', models.DateTimeField(default=django.utils.timezone.now, verbose_name='更新日')), | ||
('is_active', models.BooleanField(default=True, verbose_name='有効')), | ||
('ip_address', models.GenericIPAddressField(unique=True, verbose_name='IP Address')), | ||
('subnet', models.IntegerField(default=32, verbose_name='サブネット')), | ||
('start_at', models.DateTimeField(blank=True, null=True, verbose_name='開通日')), | ||
('end_at', models.DateTimeField(blank=True, null=True, verbose_name='解約日')), | ||
('plan', models.JSONField(blank=True, null=True, verbose_name='プラン')), | ||
('use_case', dsbd.models.MediumTextField(default='', verbose_name='使用用途')), | ||
], | ||
options={ | ||
'verbose_name': 'IP', | ||
'verbose_name_plural': 'IPs', | ||
'ordering': ('id',), | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name='IPJPNICUser', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('created_at', models.DateTimeField(default=django.utils.timezone.now, verbose_name='作成日')), | ||
('updated_at', models.DateTimeField(default=django.utils.timezone.now, verbose_name='更新日')), | ||
('user_type', models.CharField(choices=[('admin', '管理者'), ('tech1', '技術担当者1'), ('tech2', '技術担当者2'), ('tech3', '技術担当者3'), ('tech4', '技術担当者4'), ('tech5', '技術担当者5')], default='admin', max_length=255, verbose_name='タイプ')), | ||
], | ||
options={ | ||
'verbose_name': 'IP・JPNIC User', | ||
'verbose_name_plural': 'IP・JPNIC Users', | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name='JPNICUser', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('created_at', models.DateTimeField(default=django.utils.timezone.now, verbose_name='作成日')), | ||
('updated_at', models.DateTimeField(default=django.utils.timezone.now, verbose_name='更新日')), | ||
('is_active', models.BooleanField(default=True, verbose_name='有効')), | ||
('hidden', models.BooleanField(default=False, verbose_name='隠蔽')), | ||
('handle_type', models.CharField(choices=[('group_handle', 'グループハンドル'), ('jpnic_handle', 'JPNICハンドル')], default='jpnic_handle', max_length=255, verbose_name='ハンドルタイプ')), | ||
('jpnic_handle', models.CharField(blank=True, max_length=100, verbose_name='JPNIC Handle')), | ||
('name', models.CharField(max_length=150, verbose_name='name')), | ||
('name_jp', models.CharField(max_length=150, verbose_name='name(japanese)')), | ||
('email', models.EmailField(max_length=150, verbose_name='E-Mail')), | ||
('org', models.CharField(max_length=150, unique=True, verbose_name='Org')), | ||
('org_jp', models.CharField(max_length=150, verbose_name='Org(japanese)')), | ||
('postcode', models.CharField(default='', max_length=20, verbose_name='郵便番号')), | ||
('address', models.CharField(default='', max_length=250, verbose_name='住所')), | ||
('address_jp', models.CharField(default='', max_length=250, verbose_name='住所(Japanese)')), | ||
('dept', models.CharField(blank=True, default='', max_length=250, verbose_name='部署')), | ||
('dept_jp', models.CharField(blank=True, default='', max_length=250, verbose_name='部署(Japanese)')), | ||
('title', models.CharField(blank=True, default='', max_length=250, verbose_name='役職')), | ||
('title_jp', models.CharField(blank=True, default='', max_length=250, verbose_name='役職(Japanese)')), | ||
('tel', models.CharField(default='', max_length=30, verbose_name='tel')), | ||
('fax', models.CharField(default='', max_length=30, verbose_name='fax')), | ||
('country', models.CharField(default='Japan', max_length=100, verbose_name='居住国')), | ||
], | ||
options={ | ||
'verbose_name': 'JPNIC User', | ||
'verbose_name_plural': 'JPNIC Users', | ||
'ordering': ('id',), | ||
}, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Generated by Django 5.0.3 on 2024-03-31 08:50 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
('custom_auth', '0004_group_users_alter_user_groups'), | ||
('ip', '0001_initial'), | ||
('service', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='ip', | ||
name='service', | ||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='IPService', to='service.service'), | ||
), | ||
migrations.AddField( | ||
model_name='ipjpnicuser', | ||
name='ip', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='ip.ip'), | ||
), | ||
migrations.AddField( | ||
model_name='jpnicuser', | ||
name='group', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='custom_auth.group'), | ||
), | ||
migrations.AddField( | ||
model_name='jpnicuser', | ||
name='ip', | ||
field=models.ManyToManyField(blank=True, related_name='jpnic_set', through='ip.IPJPNICUser', to='ip.ip'), | ||
), | ||
migrations.AddField( | ||
model_name='ipjpnicuser', | ||
name='jpnic_user', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='ip.jpnicuser'), | ||
), | ||
migrations.AddField( | ||
model_name='ip', | ||
name='jpnic_user', | ||
field=models.ManyToManyField(blank=True, related_name='jpnic_user_set', through='ip.IPJPNICUser', to='ip.jpnicuser'), | ||
), | ||
migrations.AlterUniqueTogether( | ||
name='ipjpnicuser', | ||
unique_together={('jpnic_user', 'ip')}, | ||
), | ||
] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
from django.db import models | ||
from django.utils import timezone | ||
|
||
from custom_auth.models import Group | ||
from dsbd.models import MediumTextField | ||
from service.models import Service | ||
|
||
SERVICE_L2 = "2000" | ||
SERVICE_L3_STATIC = "3S00" | ||
SERVICE_L3_BGP = "3B00" | ||
SERVICE_TRANSIT = "IP3B" | ||
SERVICE_COLO_L2 = "CL20" | ||
SERVICE_COLO_L3_STATIC = "CL3S" | ||
SERVICE_COLO_L3_BGP = "CL3B" | ||
SERVICE_ETC = "ET00" | ||
|
||
SERVICE_CHOICES = ( | ||
(SERVICE_L2, "L2"), | ||
(SERVICE_L3_STATIC, "L3 Static"), | ||
(SERVICE_L3_BGP, "L3 BGP"), | ||
(SERVICE_TRANSIT, "トランジット提供"), | ||
(SERVICE_COLO_L2, "コロケーションサービス(L2)"), | ||
(SERVICE_COLO_L3_STATIC, "コロケーションサービス(L3 Static)"), | ||
(SERVICE_COLO_L3_BGP, "コロケーションサービス(L3 BGP)"), | ||
(SERVICE_ETC, "その他"), | ||
) | ||
|
||
|
||
class IP(models.Model): | ||
created_at = models.DateTimeField("作成日", default=timezone.now) | ||
updated_at = models.DateTimeField("更新日", default=timezone.now) | ||
is_active = models.BooleanField("有効", default=True) | ||
service = models.ForeignKey(Service, on_delete=models.SET_NULL, related_name="IPService", null=True, blank=True) | ||
ip_address = models.GenericIPAddressField("IP Address", unique=True) | ||
subnet = models.IntegerField("サブネット", default=32) | ||
start_at = models.DateTimeField("開通日", null=True, blank=True) | ||
end_at = models.DateTimeField("解約日", null=True, blank=True) | ||
plan = models.JSONField("プラン", null=True, blank=True) | ||
use_case = MediumTextField("使用用途", default="") | ||
jpnic_user = models.ManyToManyField( | ||
"JPNICUser", | ||
blank=True, | ||
through='IPJPNICUser', | ||
through_fields=('ip', 'jpnic_user'), | ||
related_name="jpnic_user_set", | ||
) | ||
|
||
class Meta: | ||
ordering = ("id",) | ||
verbose_name = "IP" | ||
verbose_name_plural = "IPs" | ||
|
||
|
||
HANDLE_TYPE_GROUP = "group_handle" | ||
HANDLE_TYPE_JPNIC = "jpnic_handle" | ||
|
||
HANDLE_TYPE_CHOICES = ( | ||
(HANDLE_TYPE_GROUP, "グループハンドル"), | ||
(HANDLE_TYPE_JPNIC, "JPNICハンドル"), | ||
) | ||
|
||
|
||
class JPNICUser(models.Model): | ||
created_at = models.DateTimeField("作成日", default=timezone.now) | ||
updated_at = models.DateTimeField("更新日", default=timezone.now) | ||
group = models.ForeignKey(Group, on_delete=models.CASCADE) | ||
is_active = models.BooleanField("有効", default=True) | ||
hidden = models.BooleanField("隠蔽", default=False) | ||
handle_type = models.CharField("ハンドルタイプ", max_length=255, choices=HANDLE_TYPE_CHOICES, default=HANDLE_TYPE_JPNIC) | ||
jpnic_handle = models.CharField("JPNIC Handle", max_length=100, blank=True) | ||
name = models.CharField("name", max_length=150) | ||
name_jp = models.CharField("name(japanese)", max_length=150) | ||
email = models.EmailField("E-Mail", max_length=150) | ||
org = models.CharField("Org", max_length=150, unique=True) | ||
org_jp = models.CharField("Org(japanese)", max_length=150) | ||
postcode = models.CharField("郵便番号", max_length=20, default="") | ||
address = models.CharField("住所", max_length=250, default="") | ||
address_jp = models.CharField("住所(Japanese)", max_length=250, default="") | ||
dept = models.CharField("部署", max_length=250, default="", blank=True) | ||
dept_jp = models.CharField("部署(Japanese)", max_length=250, default="", blank=True) | ||
title = models.CharField("役職", max_length=250, default="", blank=True) | ||
title_jp = models.CharField("役職(Japanese)", max_length=250, default="", blank=True) | ||
tel = models.CharField("tel", max_length=30, default="") | ||
fax = models.CharField("fax", max_length=30, default="") | ||
country = models.CharField("居住国", max_length=100, default="Japan") | ||
ip = models.ManyToManyField( | ||
"IP", | ||
blank=True, | ||
through='IPJPNICUser', | ||
through_fields=('jpnic_user', 'ip'), | ||
related_name="jpnic_set", | ||
) | ||
|
||
class Meta: | ||
ordering = ("id",) | ||
verbose_name = "JPNIC User" | ||
verbose_name_plural = "JPNIC Users" | ||
|
||
|
||
JPNIC_USER_TYPE_ADMIN = "admin" | ||
JPNIC_USER_TYPE_TECH_1 = "tech1" | ||
JPNIC_USER_TYPE_TECH_2 = "tech2" | ||
JPNIC_USER_TYPE_TECH_3 = "tech3" | ||
JPNIC_USER_TYPE_TECH_4 = "tech4" | ||
JPNIC_USER_TYPE_TECH_5 = "tech5" | ||
|
||
JPNIC_USER_TYPE_CHOICES = ( | ||
(JPNIC_USER_TYPE_ADMIN, "管理者"), | ||
(JPNIC_USER_TYPE_TECH_1, "技術担当者1"), | ||
(JPNIC_USER_TYPE_TECH_2, "技術担当者2"), | ||
(JPNIC_USER_TYPE_TECH_3, "技術担当者3"), | ||
(JPNIC_USER_TYPE_TECH_4, "技術担当者4"), | ||
(JPNIC_USER_TYPE_TECH_5, "技術担当者5"), | ||
) | ||
|
||
|
||
class IPJPNICUser(models.Model): | ||
created_at = models.DateTimeField("作成日", default=timezone.now) | ||
updated_at = models.DateTimeField("更新日", default=timezone.now) | ||
jpnic_user = models.ForeignKey(JPNICUser, on_delete=models.CASCADE) | ||
ip = models.ForeignKey(IP, on_delete=models.CASCADE) | ||
user_type = models.CharField("タイプ", max_length=255, choices=JPNIC_USER_TYPE_CHOICES, default=JPNIC_USER_TYPE_ADMIN) | ||
|
||
class Meta: | ||
verbose_name = 'IP・JPNIC User' | ||
verbose_name_plural = "IP・JPNIC Users" | ||
unique_together = ('jpnic_user', 'ip') | ||
|
||
def __str__(self): | ||
return "%s" % (self.id,) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from django.contrib import admin | ||
|
||
from .models import NOC | ||
|
||
|
||
@admin.register(NOC) | ||
class NOC(admin.ModelAdmin): | ||
fieldsets = ( | ||
(None, {'fields': ('name', 'is_active', 'location', 'bandwidth',)}), | ||
('comment', {'fields': ('comment',)}), | ||
('Important dates', {'fields': ('created_at', 'updated_at',)}), | ||
) | ||
list_display = ('id', 'name', 'is_active', 'location', 'bandwidth') | ||
list_filter = ('is_active', ) | ||
search_fields = ('name',) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class CustomAdmin(AppConfig): | ||
name = "noc" | ||
verbose_name = "NOC" |
Oops, something went wrong.