Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
re2o
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nounous
re2o
Commits
aba2d73f
Commit
aba2d73f
authored
Jul 06, 2016
by
chirac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deplace les models forms dans forms
parent
78a46680
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
34 deletions
+38
-34
machines/forms.py
machines/forms.py
+36
-0
machines/models.py
machines/models.py
+1
-33
machines/views.py
machines/views.py
+1
-1
No files found.
machines/forms.py
0 → 100644
View file @
aba2d73f
from
django.forms
import
ModelForm
,
Form
,
ValidationError
from
.models
import
Machine
,
Interface
class
EditMachineForm
(
ModelForm
):
class
Meta
:
model
=
Machine
fields
=
'__all__'
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
EditMachineForm
,
self
).
__init__
(
*
args
,
**
kwargs
)
self
.
fields
[
'name'
].
label
=
'Nom de la machine'
self
.
fields
[
'type'
].
label
=
'Type de machine'
self
.
fields
[
'type'
].
empty_label
=
"Séléctionner un type de machine"
class
NewMachineForm
(
EditMachineForm
):
class
Meta
(
EditMachineForm
.
Meta
):
fields
=
[
'type'
,
'name'
]
class
EditInterfaceForm
(
ModelForm
):
class
Meta
:
model
=
Interface
fields
=
'__all__'
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
EditInterfaceForm
,
self
).
__init__
(
*
args
,
**
kwargs
)
self
.
fields
[
'dns'
].
label
=
'Nom dns de la machine'
self
.
fields
[
'mac_address'
].
label
=
'Adresse mac'
class
AddInterfaceForm
(
EditInterfaceForm
):
class
Meta
(
EditInterfaceForm
.
Meta
):
fields
=
[
'ipv4'
,
'mac_address'
,
'dns'
,
'details'
]
class
NewInterfaceForm
(
EditInterfaceForm
):
class
Meta
(
EditInterfaceForm
.
Meta
):
fields
=
[
'mac_address'
,
'dns'
,
'details'
]
machines/models.py
View file @
aba2d73f
from
django.db
import
models
from
django.forms
import
ModelForm
,
Form
,
ValidationError
from
django.forms
import
ValidationError
from
macaddress.fields
import
MACAddressField
from
django.conf
import
settings
...
...
@@ -64,35 +64,3 @@ class IpList(models.Model):
def
__str__
(
self
):
return
self
.
ipv4
class
EditMachineForm
(
ModelForm
):
class
Meta
:
model
=
Machine
fields
=
'__all__'
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
EditMachineForm
,
self
).
__init__
(
*
args
,
**
kwargs
)
self
.
fields
[
'name'
].
label
=
'Nom de la machine'
self
.
fields
[
'type'
].
label
=
'Type de machine'
self
.
fields
[
'type'
].
empty_label
=
"Séléctionner un type de machine"
class
NewMachineForm
(
EditMachineForm
):
class
Meta
(
EditMachineForm
.
Meta
):
fields
=
[
'type'
,
'name'
]
class
EditInterfaceForm
(
ModelForm
):
class
Meta
:
model
=
Interface
fields
=
'__all__'
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
EditInterfaceForm
,
self
).
__init__
(
*
args
,
**
kwargs
)
self
.
fields
[
'dns'
].
label
=
'Nom dns de la machine'
self
.
fields
[
'mac_address'
].
label
=
'Adresse mac'
class
AddInterfaceForm
(
EditInterfaceForm
):
class
Meta
(
EditInterfaceForm
.
Meta
):
fields
=
[
'ipv4'
,
'mac_address'
,
'dns'
,
'details'
]
class
NewInterfaceForm
(
EditInterfaceForm
):
class
Meta
(
EditInterfaceForm
.
Meta
):
fields
=
[
'mac_address'
,
'dns'
,
'details'
]
machines/views.py
View file @
aba2d73f
...
...
@@ -7,7 +7,7 @@ from django.core.context_processors import csrf
from
django.template
import
Context
,
RequestContext
,
loader
from
django.contrib
import
messages
from
.
model
s
import
NewMachineForm
,
EditMachineForm
,
EditInterfaceForm
,
AddInterfaceForm
,
NewInterfaceForm
from
.
form
s
import
NewMachineForm
,
EditMachineForm
,
EditInterfaceForm
,
AddInterfaceForm
,
NewInterfaceForm
from
.models
import
Machine
,
Interface
,
IpList
from
users.models
import
User
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment