Created
May 29, 2013 12:38
-
-
Save scottyob/5669974 to your computer and use it in GitHub Desktop.
Playing with the idea of bidirectional relations between patch panels
This file contains hidden or 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
from django.db import models | |
# Create your models here. | |
class PatchPanel(models.Model): | |
""" | |
Represents a physical patch panel. This could be a FOBOT or a Krone frame. Whatever really | |
""" | |
name = models.CharField(max_length=100, null=False, blank=True, unique=True, help_text="The name used to identify the panel. (Eg. B15 PABX Panel K)") | |
outlets = models.IntegerField(help_text="The number of outlets on the panel") | |
class PortType(models.Model): | |
""" | |
A Group of outlets on a patch panel have a type, be it Single mode, multi-mode, etc. | |
""" | |
description = models.CharField(max_length=50) | |
class Port(models.Model): | |
""" | |
An individual port on the Patch Panel | |
""" | |
panel = models.ForeignKey(PatchPanel) | |
type = models.ForeignKey(PortType) | |
number = models.IntegerField() | |
class CableRun(models.Model): | |
""" | |
Represents a single cable run. | |
""" | |
port1 = models.ForeignKey(Port) | |
port2 = models.ForeignKey(Port) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment