8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-22 03:13:12 +00:00

Simplification, évite les imports circulaires, permet donc à un port d'avoir une interface, et à une chambre d'avoir un port (<->)

This commit is contained in:
chirac 2016-07-06 12:23:45 +02:00
parent a58e90cc2f
commit 48d76b3f3f
10 changed files with 75 additions and 9 deletions

4
.gitignore vendored
View file

@ -1,4 +1,4 @@
settings.py settings_local.py
settings*
*.swp *.swp
*.pyc *.pyc
__pycache__

View file

@ -2,7 +2,6 @@ from django.db import models
from django import forms from django import forms
from django.forms import ModelForm from django.forms import ModelForm
from users.models import User
class Facture(models.Model): class Facture(models.Model):
user = models.ForeignKey('users.User', on_delete=models.PROTECT) user = models.ForeignKey('users.User', on_delete=models.PROTECT)

View file

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import machines.models
class Migration(migrations.Migration):
dependencies = [
('machines', '0013_auto_20160705_1014'),
]
operations = [
migrations.AlterField(
model_name='interface',
name='dns',
field=models.CharField(unique=True, validators=[machines.models.full_domain_validator], max_length=255, help_text="Obligatoire et unique, doit se terminer en .rez et ne pas comporter d'autres points"),
),
]

View file

@ -2,7 +2,6 @@ from django.db import models
from django.forms import ModelForm, Form, ValidationError from django.forms import ModelForm, Form, ValidationError
from macaddress.fields import MACAddressField from macaddress.fields import MACAddressField
from users.models import User
from django.conf import settings from django.conf import settings
import re import re

View file

@ -3,9 +3,6 @@ from django import forms
from django.forms import Form from django.forms import Form
from django.forms import ModelForm from django.forms import ModelForm
from users.models import User
# Create your models here.
CHOICES = ( CHOICES = (
('0', 'Actifs'), ('0', 'Actifs'),
('1', 'Désactivés'), ('1', 'Désactivés'),

View file

@ -7,7 +7,7 @@ class SwitchAdmin(admin.ModelAdmin):
list_display = ('building','number','details') list_display = ('building','number','details')
class PortAdmin(admin.ModelAdmin): class PortAdmin(admin.ModelAdmin):
list_display = ('switch', 'port','room','details') list_display = ('switch', 'port','room','machine_interface','details')
class RoomAdmin(admin.ModelAdmin): class RoomAdmin(admin.ModelAdmin):
list_display = ('name',) list_display = ('name',)

View file

@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('machines', '0014_auto_20160706_1220'),
('topologie', '0011_auto_20160704_2153'),
]
operations = [
migrations.AddField(
model_name='port',
name='machine_interface',
field=models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, null=True, blank=True, to='machines.Interface'),
),
]

View file

@ -19,7 +19,7 @@ class Port(models.Model):
port = models.IntegerField() port = models.IntegerField()
details = models.CharField(max_length=255, blank=True) details = models.CharField(max_length=255, blank=True)
room = models.ForeignKey('Room', on_delete=models.PROTECT, blank=True, null=True) room = models.ForeignKey('Room', on_delete=models.PROTECT, blank=True, null=True)
# machine_interface = models.OneToOneField('machines.Interface', on_delete=models.PROTECT, blank=True, null=True) machine_interface = models.OneToOneField('machines.Interface', on_delete=models.PROTECT, blank=True, null=True)
class Meta: class Meta:
unique_together = ('_content_type', '_object_id') unique_together = ('_content_type', '_object_id')

View file

@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import users.models
class Migration(migrations.Migration):
dependencies = [
('users', '0015_whitelist'),
]
operations = [
migrations.AlterField(
model_name='ban',
name='date_end',
field=models.DateTimeField(help_text='%d/%m/%y %H:%M:%S'),
),
migrations.AlterField(
model_name='user',
name='pseudo',
field=models.CharField(unique=True, validators=[users.models.linux_user_validator], max_length=32, help_text='Doit contenir uniquement des lettres, chiffres, ou tirets'),
),
migrations.AlterField(
model_name='whitelist',
name='date_end',
field=models.DateTimeField(help_text='%d/%m/%y %H:%M:%S'),
),
]