1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Extended primary models to include 'created' and 'last_updated' fields

This commit is contained in:
Jeremy Stretch
2016-06-22 10:19:00 -04:00
parent f42c0643e0
commit cb5991d5a6
8 changed files with 191 additions and 10 deletions

View File

@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-22 14:10
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('circuits', '0003_auto_20160621_1728'),
]
operations = [
migrations.AddField(
model_name='circuit',
name='created',
field=models.DateField(auto_now_add=True, default=datetime.date(2016, 6, 22)),
preserve_default=False,
),
migrations.AddField(
model_name='circuit',
name='last_updated',
field=models.DateTimeField(auto_now=True, default=datetime.datetime(2016, 6, 22, 14, 10, 28, 340517)),
preserve_default=False,
),
migrations.AddField(
model_name='provider',
name='created',
field=models.DateField(auto_now_add=True, default=datetime.date(2016, 6, 22)),
preserve_default=False,
),
migrations.AddField(
model_name='provider',
name='last_updated',
field=models.DateTimeField(auto_now=True, default=datetime.datetime(2016, 6, 22, 14, 10, 40, 964944)),
preserve_default=False,
),
]

View File

@ -2,9 +2,10 @@ from django.core.urlresolvers import reverse
from django.db import models
from dcim.models import Site, Interface
from utilities.models import CreatedUpdatedModel
class Provider(models.Model):
class Provider(CreatedUpdatedModel):
"""
Each Circuit belongs to a Provider. This is usually a telecommunications company or similar organization. This model
stores information pertinent to the user's relationship with the Provider.
@ -55,7 +56,7 @@ class CircuitType(models.Model):
return "{}?type={}".format(reverse('circuits:circuit_list'), self.slug)
class Circuit(models.Model):
class Circuit(CreatedUpdatedModel):
"""
A communications circuit connects two points. Each Circuit belongs to a Provider; Providers may have multiple
circuits. Each circuit is also assigned a CircuitType and a Site. A Circuit may be terminated to a specific device