Browse Source

Crée l'application topologie

test_david
chirac 10 years ago
parent
commit
857adf1eb0
  1. 3
      machines/models.py
  2. 0
      topologie/__init__.py
  3. BIN
      topologie/__pycache__/__init__.cpython-34.pyc
  4. BIN
      topologie/__pycache__/admin.cpython-34.pyc
  5. BIN
      topologie/__pycache__/models.cpython-34.pyc
  6. 20
      topologie/admin.py
  7. 35
      topologie/migrations/0001_initial.py
  8. 19
      topologie/migrations/0002_auto_20160703_0103.py
  9. 24
      topologie/migrations/0003_link.py
  10. 0
      topologie/migrations/__init__.py
  11. BIN
      topologie/migrations/__pycache__/0001_initial.cpython-34.pyc
  12. BIN
      topologie/migrations/__pycache__/0002_auto_20160703_0103.cpython-34.pyc
  13. BIN
      topologie/migrations/__pycache__/0003_link.cpython-34.pyc
  14. BIN
      topologie/migrations/__pycache__/__init__.cpython-34.pyc
  15. 29
      topologie/models.py
  16. 3
      topologie/tests.py
  17. 3
      topologie/views.py

3
machines/models.py

@ -14,3 +14,6 @@ class MachineType(models.Model):
def __str__(self):
return self.type

0
topologie/__init__.py

BIN
topologie/__pycache__/__init__.cpython-34.pyc

Binary file not shown.

BIN
topologie/__pycache__/admin.cpython-34.pyc

Binary file not shown.

BIN
topologie/__pycache__/models.cpython-34.pyc

Binary file not shown.

20
topologie/admin.py

@ -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

@ -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

@ -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

@ -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

BIN
topologie/migrations/__pycache__/0001_initial.cpython-34.pyc

Binary file not shown.

BIN
topologie/migrations/__pycache__/0002_auto_20160703_0103.cpython-34.pyc

Binary file not shown.

BIN
topologie/migrations/__pycache__/0003_link.cpython-34.pyc

Binary file not shown.

BIN
topologie/migrations/__pycache__/__init__.cpython-34.pyc

Binary file not shown.

29
topologie/models.py

@ -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

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

3
topologie/views.py

@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.
Loading…
Cancel
Save