mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-27 01:13:46 +00:00
Supprime des contraintes inutiles
This commit is contained in:
parent
23bff5252e
commit
a6ebf5f375
3 changed files with 42 additions and 4 deletions
19
machines/migrations/0010_auto_20160704_0104.py
Normal file
19
machines/migrations/0010_auto_20160704_0104.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 = [
|
||||||
|
('machines', '0009_auto_20160703_2358'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='machine',
|
||||||
|
name='name',
|
||||||
|
field=models.CharField(blank=True, unique=True, max_length=255, help_text='Optionnel', null=True),
|
||||||
|
),
|
||||||
|
]
|
19
machines/migrations/0011_auto_20160704_0105.py
Normal file
19
machines/migrations/0011_auto_20160704_0105.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 = [
|
||||||
|
('machines', '0010_auto_20160704_0104'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='machine',
|
||||||
|
name='name',
|
||||||
|
field=models.CharField(help_text='Optionnel', blank=True, null=True, max_length=255),
|
||||||
|
),
|
||||||
|
]
|
|
@ -7,7 +7,7 @@ from users.models import User
|
||||||
class Machine(models.Model):
|
class Machine(models.Model):
|
||||||
user = models.ForeignKey('users.User', on_delete=models.PROTECT)
|
user = models.ForeignKey('users.User', on_delete=models.PROTECT)
|
||||||
type = models.ForeignKey('MachineType', on_delete=models.PROTECT)
|
type = models.ForeignKey('MachineType', on_delete=models.PROTECT)
|
||||||
name = models.CharField(max_length=255, help_text="Optionnel", unique=True, blank=True)
|
name = models.CharField(max_length=255, help_text="Optionnel", blank=True, null=True)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.user) + ' - ' + str(self.id) + ' - ' + str(self.name)
|
return str(self.user) + ' - ' + str(self.id) + ' - ' + str(self.name)
|
||||||
|
@ -25,7 +25,7 @@ class Interface(models.Model):
|
||||||
mac_address = MACAddressField(integer=False, unique=True)
|
mac_address = MACAddressField(integer=False, unique=True)
|
||||||
machine = models.ForeignKey('Machine', on_delete=models.PROTECT)
|
machine = models.ForeignKey('Machine', on_delete=models.PROTECT)
|
||||||
details = models.CharField(max_length=255, blank=True)
|
details = models.CharField(max_length=255, blank=True)
|
||||||
dns = models.CharField(max_length=255, unique=True)
|
dns = models.CharField(help_text="Obligatoire et unique", max_length=255, unique=True)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.dns
|
return self.dns
|
||||||
|
@ -43,7 +43,7 @@ class EditMachineForm(ModelForm):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(EditMachineForm, self).__init__(*args, **kwargs)
|
super(EditMachineForm, self).__init__(*args, **kwargs)
|
||||||
self.fields['name'].label = 'Nom de la machine (optionnel)'
|
self.fields['name'].label = 'Nom de la machine'
|
||||||
self.fields['type'].label = 'Type de machine'
|
self.fields['type'].label = 'Type de machine'
|
||||||
|
|
||||||
class NewMachineForm(EditMachineForm):
|
class NewMachineForm(EditMachineForm):
|
||||||
|
@ -57,7 +57,7 @@ class EditInterfaceForm(ModelForm):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(EditInterfaceForm, self).__init__(*args, **kwargs)
|
super(EditInterfaceForm, self).__init__(*args, **kwargs)
|
||||||
self.fields['dns'].label = 'Nom dns de la machine (unique)'
|
self.fields['dns'].label = 'Nom dns de la machine'
|
||||||
self.fields['mac_address'].label = 'Adresse mac'
|
self.fields['mac_address'].label = 'Adresse mac'
|
||||||
|
|
||||||
class AddInterfaceForm(EditInterfaceForm):
|
class AddInterfaceForm(EditInterfaceForm):
|
||||||
|
|
Loading…
Reference in a new issue