mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-27 07:02:26 +00:00
Crée l'application topologie
This commit is contained in:
parent
152224ae7d
commit
857adf1eb0
17 changed files with 136 additions and 0 deletions
|
@ -14,3 +14,6 @@ class MachineType(models.Model):
|
|||
|
||||
def __str__(self):
|
||||
return self.type
|
||||
|
||||
|
||||
|
||||
|
|
0
topologie/__init__.py
Normal file
0
topologie/__init__.py
Normal file
BIN
topologie/__pycache__/__init__.cpython-34.pyc
Normal file
BIN
topologie/__pycache__/__init__.cpython-34.pyc
Normal file
Binary file not shown.
BIN
topologie/__pycache__/admin.cpython-34.pyc
Normal file
BIN
topologie/__pycache__/admin.cpython-34.pyc
Normal file
Binary file not shown.
BIN
topologie/__pycache__/models.cpython-34.pyc
Normal file
BIN
topologie/__pycache__/models.cpython-34.pyc
Normal file
Binary file not shown.
20
topologie/admin.py
Normal file
20
topologie/admin.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
|
||||
from django.contrib import admin
|
||||
|
||||
from .models import Port, Room, Link
|
||||
|
||||
class PortAdmin(admin.ModelAdmin):
|
||||
list_display = ('building','switch', 'port','details')
|
||||
|
||||
class RoomAdmin(admin.ModelAdmin):
|
||||
list_display = ('room','details')
|
||||
|
||||
class RoomAdmin(admin.ModelAdmin):
|
||||
list_display = ('room','details')
|
||||
|
||||
class LinkAdmin(admin.ModelAdmin):
|
||||
list_display = ('port', 'room','details')
|
||||
|
||||
admin.site.register(Port, PortAdmin)
|
||||
admin.site.register(Room, RoomAdmin)
|
||||
admin.site.register(Link, LinkAdmin)
|
35
topologie/migrations/0001_initial.py
Normal file
35
topologie/migrations/0001_initial.py
Normal file
|
@ -0,0 +1,35 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Port',
|
||||
fields=[
|
||||
('id', models.AutoField(serialize=False, primary_key=True, auto_created=True, verbose_name='ID')),
|
||||
('building', models.CharField(max_length=10)),
|
||||
('switch', models.IntegerField()),
|
||||
('port', models.IntegerField()),
|
||||
('details', models.CharField(blank=True, max_length=255)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Room',
|
||||
fields=[
|
||||
('id', models.AutoField(serialize=False, primary_key=True, auto_created=True, verbose_name='ID')),
|
||||
('details', models.CharField(blank=True, max_length=255)),
|
||||
('room', models.CharField(max_length=255)),
|
||||
],
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='port',
|
||||
unique_together=set([('building', 'switch', 'port')]),
|
||||
),
|
||||
]
|
19
topologie/migrations/0002_auto_20160703_0103.py
Normal file
19
topologie/migrations/0002_auto_20160703_0103.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('topologie', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='room',
|
||||
name='room',
|
||||
field=models.CharField(unique=True, max_length=255),
|
||||
),
|
||||
]
|
24
topologie/migrations/0003_link.py
Normal file
24
topologie/migrations/0003_link.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('topologie', '0002_auto_20160703_0103'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Link',
|
||||
fields=[
|
||||
('id', models.AutoField(verbose_name='ID', auto_created=True, serialize=False, primary_key=True)),
|
||||
('details', models.CharField(blank=True, max_length=255)),
|
||||
('port', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='topologie.Port')),
|
||||
('room', models.ForeignKey(to='topologie.Room', on_delete=django.db.models.deletion.PROTECT, blank=True)),
|
||||
],
|
||||
),
|
||||
]
|
0
topologie/migrations/__init__.py
Normal file
0
topologie/migrations/__init__.py
Normal file
BIN
topologie/migrations/__pycache__/0001_initial.cpython-34.pyc
Normal file
BIN
topologie/migrations/__pycache__/0001_initial.cpython-34.pyc
Normal file
Binary file not shown.
Binary file not shown.
BIN
topologie/migrations/__pycache__/0003_link.cpython-34.pyc
Normal file
BIN
topologie/migrations/__pycache__/0003_link.cpython-34.pyc
Normal file
Binary file not shown.
BIN
topologie/migrations/__pycache__/__init__.cpython-34.pyc
Normal file
BIN
topologie/migrations/__pycache__/__init__.cpython-34.pyc
Normal file
Binary file not shown.
29
topologie/models.py
Normal file
29
topologie/models.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
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)
|
3
topologie/tests.py
Normal file
3
topologie/tests.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
3
topologie/views.py
Normal file
3
topologie/views.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
Loading…
Reference in a new issue