Skip to content

Instantly share code, notes, and snippets.

@scottyob
Created May 29, 2013 12:38
Show Gist options
  • Save scottyob/5669974 to your computer and use it in GitHub Desktop.
Save scottyob/5669974 to your computer and use it in GitHub Desktop.
Playing with the idea of bidirectional relations between patch panels
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