mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-26 00:43:46 +00:00
29 lines
973 B
Python
29 lines
973 B
Python
from django.db import models
|
|
|
|
class Port(models.Model):
|
|
building = models.CharField(max_length=10)
|
|
switch = models.IntegerField()
|
|
port = models.IntegerField()
|
|
details = models.CharField(max_length=255, blank=True)
|
|
|
|
class Meta:
|
|
unique_together = ("building", "switch", "port")
|
|
|
|
def __str__(self):
|
|
return str(self.building) + " - " + str(self.switch) + " - " + str(self.port)
|
|
|
|
class Room(models.Model):
|
|
details = models.CharField(max_length=255, blank=True)
|
|
room = models.CharField(max_length=255, unique=True)
|
|
|
|
def __str__(self):
|
|
return str(self.room)
|
|
|
|
class Link(models.Model):
|
|
port = models.ForeignKey('Port', on_delete=models.PROTECT)
|
|
details = models.CharField(max_length=255, blank=True)
|
|
#port_linked = models.ForeignKey('Port', on_delete=models.PROTECT, blank=True)
|
|
room = models.ForeignKey('Room', on_delete=models.PROTECT, blank=True)
|
|
|
|
def __str__(self):
|
|
return str(self.port)
|