Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
001fea56
authored
Mar 18, 2015
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: fix #302 (specify a default ordering in every model class)
Closes #302
parent
496bcee2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
129 additions
and
1 deletions
+129
-1
circle/dashboard/migrations/0002_auto_20150318_1317.py
+30
-0
circle/dashboard/models.py
+8
-0
circle/dashboard/tables.py
+2
-0
circle/firewall/migrations/0004_auto_20150318_1317.py
+50
-0
circle/firewall/models.py
+39
-1
No files found.
circle/dashboard/migrations/0002_auto_20150318_1317.py
0 → 100644
View file @
001fea56
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
models
,
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'dashboard'
,
'0001_initial'
),
]
operations
=
[
migrations
.
AlterModelOptions
(
name
=
'connectcommand'
,
options
=
{
'ordering'
:
(
'id'
,)},
),
migrations
.
AlterModelOptions
(
name
=
'futuremember'
,
options
=
{
'ordering'
:
(
'id'
,)},
),
migrations
.
AlterModelOptions
(
name
=
'groupprofile'
,
options
=
{
'ordering'
:
(
'id'
,)},
),
migrations
.
AlterModelOptions
(
name
=
'profile'
,
options
=
{
'ordering'
:
(
'id'
,),
'permissions'
:
((
'use_autocomplete'
,
'Can use autocomplete.'
),)},
),
]
circle/dashboard/models.py
View file @
001fea56
...
@@ -128,6 +128,9 @@ class ConnectCommand(Model):
...
@@ -128,6 +128,9 @@ class ConnectCommand(Model):
'host, port.'
),
'host, port.'
),
validators
=
[
connect_command_template_validator
])
validators
=
[
connect_command_template_validator
])
class
Meta
:
ordering
=
(
'id'
,
)
def
__unicode__
(
self
):
def
__unicode__
(
self
):
return
self
.
template
return
self
.
template
...
@@ -218,6 +221,7 @@ class Profile(Model):
...
@@ -218,6 +221,7 @@ class Profile(Model):
super
(
Profile
,
self
)
.
save
(
*
args
,
**
kwargs
)
super
(
Profile
,
self
)
.
save
(
*
args
,
**
kwargs
)
class
Meta
:
class
Meta
:
ordering
=
(
'id'
,
)
permissions
=
(
permissions
=
(
(
'use_autocomplete'
,
_
(
'Can use autocomplete.'
)),
(
'use_autocomplete'
,
_
(
'Can use autocomplete.'
)),
)
)
...
@@ -229,6 +233,7 @@ class FutureMember(Model):
...
@@ -229,6 +233,7 @@ class FutureMember(Model):
group
=
ForeignKey
(
Group
)
group
=
ForeignKey
(
Group
)
class
Meta
:
class
Meta
:
ordering
=
(
'id'
,
)
unique_together
=
(
'org_id'
,
'group'
)
unique_together
=
(
'org_id'
,
'group'
)
def
__unicode__
(
self
):
def
__unicode__
(
self
):
...
@@ -247,6 +252,9 @@ class GroupProfile(AclBase):
...
@@ -247,6 +252,9 @@ class GroupProfile(AclBase):
help_text
=
_
(
'Unique identifier of the group at the organization.'
))
help_text
=
_
(
'Unique identifier of the group at the organization.'
))
description
=
TextField
(
blank
=
True
)
description
=
TextField
(
blank
=
True
)
class
Meta
:
ordering
=
(
'id'
,
)
def
__unicode__
(
self
):
def
__unicode__
(
self
):
return
self
.
group
.
name
return
self
.
group
.
name
...
...
circle/dashboard/tables.py
View file @
001fea56
...
@@ -149,6 +149,7 @@ class GroupListTable(Table):
...
@@ -149,6 +149,7 @@ class GroupListTable(Table):
attrs
=
{
'class'
:
(
'table table-bordered table-striped table-hover '
attrs
=
{
'class'
:
(
'table table-bordered table-striped table-hover '
'group-list-table'
)}
'group-list-table'
)}
fields
=
(
'pk'
,
'name'
,
)
fields
=
(
'pk'
,
'name'
,
)
order_by
=
(
'pk'
,
)
class
UserListTable
(
Table
):
class
UserListTable
(
Table
):
...
@@ -176,6 +177,7 @@ class UserListTable(Table):
...
@@ -176,6 +177,7 @@ class UserListTable(Table):
attrs
=
{
'class'
:
(
'table table-bordered table-striped table-hover'
)}
attrs
=
{
'class'
:
(
'table table-bordered table-striped table-hover'
)}
fields
=
(
'username'
,
'last_name'
,
'first_name'
,
'profile__org_id'
,
fields
=
(
'username'
,
'last_name'
,
'first_name'
,
'profile__org_id'
,
'email'
,
'is_active'
,
'is_superuser'
)
'email'
,
'is_active'
,
'is_superuser'
)
order_by
=
(
'username'
,
)
class
TemplateListTable
(
Table
):
class
TemplateListTable
(
Table
):
...
...
circle/firewall/migrations/0004_auto_20150318_1317.py
0 → 100644
View file @
001fea56
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
models
,
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'firewall'
,
'0003_auto_20150226_1927'
),
]
operations
=
[
migrations
.
AlterModelOptions
(
name
=
'blacklistitem'
,
options
=
{
'ordering'
:
(
'id'
,),
'verbose_name'
:
'blacklist item'
,
'verbose_name_plural'
:
'blacklist items'
},
),
migrations
.
AlterModelOptions
(
name
=
'domain'
,
options
=
{
'ordering'
:
(
'id'
,),
'verbose_name'
:
'domain'
,
'verbose_name_plural'
:
'domains'
},
),
migrations
.
AlterModelOptions
(
name
=
'ethernetdevice'
,
options
=
{
'ordering'
:
(
'id'
,),
'verbose_name'
:
'ethernet device'
,
'verbose_name_plural'
:
'ethernet devices'
},
),
migrations
.
AlterModelOptions
(
name
=
'firewall'
,
options
=
{
'ordering'
:
(
'id'
,),
'verbose_name'
:
'firewall'
,
'verbose_name_plural'
:
'firewalls'
},
),
migrations
.
AlterModelOptions
(
name
=
'group'
,
options
=
{
'ordering'
:
(
'id'
,),
'verbose_name'
:
'host group'
,
'verbose_name_plural'
:
'host groups'
},
),
migrations
.
AlterModelOptions
(
name
=
'record'
,
options
=
{
'ordering'
:
(
'domain'
,
'name'
),
'verbose_name'
:
'record'
,
'verbose_name_plural'
:
'records'
},
),
migrations
.
AlterModelOptions
(
name
=
'switchport'
,
options
=
{
'ordering'
:
(
'id'
,),
'verbose_name'
:
'switch port'
,
'verbose_name_plural'
:
'switch ports'
},
),
migrations
.
AlterModelOptions
(
name
=
'vlan'
,
options
=
{
'ordering'
:
(
'vid'
,),
'verbose_name'
:
'vlan'
,
'verbose_name_plural'
:
'vlans'
},
),
migrations
.
AlterModelOptions
(
name
=
'vlangroup'
,
options
=
{
'ordering'
:
(
'id'
,),
'verbose_name'
:
'vlan group'
,
'verbose_name_plural'
:
'vlan groups'
},
),
]
circle/firewall/models.py
View file @
001fea56
...
@@ -391,6 +391,11 @@ class Vlan(AclBase, models.Model):
...
@@ -391,6 +391,11 @@ class Vlan(AclBase, models.Model):
modified_at
=
models
.
DateTimeField
(
auto_now
=
True
,
modified_at
=
models
.
DateTimeField
(
auto_now
=
True
,
verbose_name
=
_
(
'modified at'
))
verbose_name
=
_
(
'modified at'
))
class
Meta
:
verbose_name
=
_
(
"vlan"
)
verbose_name_plural
=
_
(
"vlans"
)
ordering
=
(
'vid'
,
)
def
clean
(
self
):
def
clean
(
self
):
super
(
Vlan
,
self
)
.
clean
()
super
(
Vlan
,
self
)
.
clean
()
if
self
.
ipv6_template
:
if
self
.
ipv6_template
:
...
@@ -540,6 +545,11 @@ class VlanGroup(models.Model):
...
@@ -540,6 +545,11 @@ class VlanGroup(models.Model):
modified_at
=
models
.
DateTimeField
(
auto_now
=
True
,
modified_at
=
models
.
DateTimeField
(
auto_now
=
True
,
verbose_name
=
_
(
'modified at'
))
verbose_name
=
_
(
'modified at'
))
class
Meta
:
verbose_name
=
_
(
"vlan group"
)
verbose_name_plural
=
_
(
"vlan groups"
)
ordering
=
(
'id'
,
)
def
__unicode__
(
self
):
def
__unicode__
(
self
):
return
self
.
name
return
self
.
name
...
@@ -562,6 +572,11 @@ class Group(models.Model):
...
@@ -562,6 +572,11 @@ class Group(models.Model):
modified_at
=
models
.
DateTimeField
(
auto_now
=
True
,
modified_at
=
models
.
DateTimeField
(
auto_now
=
True
,
verbose_name
=
_
(
'modified at'
))
verbose_name
=
_
(
'modified at'
))
class
Meta
:
verbose_name
=
_
(
"host group"
)
verbose_name_plural
=
_
(
"host groups"
)
ordering
=
(
'id'
,
)
def
__unicode__
(
self
):
def
__unicode__
(
self
):
return
self
.
name
return
self
.
name
...
@@ -935,6 +950,11 @@ class Firewall(models.Model):
...
@@ -935,6 +950,11 @@ class Firewall(models.Model):
name
=
models
.
CharField
(
max_length
=
20
,
unique
=
True
,
name
=
models
.
CharField
(
max_length
=
20
,
unique
=
True
,
verbose_name
=
_
(
'name'
))
verbose_name
=
_
(
'name'
))
class
Meta
:
verbose_name
=
_
(
"firewall"
)
verbose_name_plural
=
_
(
"firewalls"
)
ordering
=
(
'id'
,
)
def
__unicode__
(
self
):
def
__unicode__
(
self
):
return
self
.
name
return
self
.
name
...
@@ -981,6 +1001,11 @@ class Domain(models.Model):
...
@@ -981,6 +1001,11 @@ class Domain(models.Model):
ttl
=
models
.
IntegerField
(
default
=
600
,
verbose_name
=
_
(
'ttl'
))
ttl
=
models
.
IntegerField
(
default
=
600
,
verbose_name
=
_
(
'ttl'
))
description
=
models
.
TextField
(
blank
=
True
,
verbose_name
=
_
(
'description'
))
description
=
models
.
TextField
(
blank
=
True
,
verbose_name
=
_
(
'description'
))
class
Meta
:
verbose_name
=
_
(
"domain"
)
verbose_name_plural
=
_
(
"domains"
)
ordering
=
(
'id'
,
)
def
__unicode__
(
self
):
def
__unicode__
(
self
):
return
self
.
name
return
self
.
name
...
@@ -1058,6 +1083,8 @@ class Record(models.Model):
...
@@ -1058,6 +1083,8 @@ class Record(models.Model):
return
reverse
(
'network.record'
,
kwargs
=
{
'pk'
:
self
.
pk
})
return
reverse
(
'network.record'
,
kwargs
=
{
'pk'
:
self
.
pk
})
class
Meta
:
class
Meta
:
verbose_name
=
_
(
"record"
)
verbose_name_plural
=
_
(
"records"
)
ordering
=
(
ordering
=
(
'domain'
,
'domain'
,
'name'
,
'name'
,
...
@@ -1077,6 +1104,11 @@ class SwitchPort(models.Model):
...
@@ -1077,6 +1104,11 @@ class SwitchPort(models.Model):
modified_at
=
models
.
DateTimeField
(
auto_now
=
True
,
modified_at
=
models
.
DateTimeField
(
auto_now
=
True
,
verbose_name
=
_
(
'modified_at'
))
verbose_name
=
_
(
'modified_at'
))
class
Meta
:
verbose_name
=
_
(
"switch port"
)
verbose_name_plural
=
_
(
"switch ports"
)
ordering
=
(
'id'
,
)
def
__unicode__
(
self
):
def
__unicode__
(
self
):
devices
=
','
.
join
(
self
.
ethernet_devices
.
values_list
(
'name'
,
devices
=
','
.
join
(
self
.
ethernet_devices
.
values_list
(
'name'
,
flat
=
True
))
flat
=
True
))
...
@@ -1104,6 +1136,11 @@ class EthernetDevice(models.Model):
...
@@ -1104,6 +1136,11 @@ class EthernetDevice(models.Model):
modified_at
=
models
.
DateTimeField
(
auto_now
=
True
,
modified_at
=
models
.
DateTimeField
(
auto_now
=
True
,
verbose_name
=
_
(
'modified_at'
))
verbose_name
=
_
(
'modified_at'
))
class
Meta
:
verbose_name
=
_
(
"ethernet device"
)
verbose_name_plural
=
_
(
"ethernet devices"
)
ordering
=
(
'id'
,
)
def
__unicode__
(
self
):
def
__unicode__
(
self
):
return
self
.
name
return
self
.
name
...
@@ -1136,7 +1173,8 @@ class BlacklistItem(models.Model):
...
@@ -1136,7 +1173,8 @@ class BlacklistItem(models.Model):
class
Meta
(
object
):
class
Meta
(
object
):
verbose_name
=
_
(
'blacklist item'
)
verbose_name
=
_
(
'blacklist item'
)
verbose_name_plural
=
_
(
'blacklist'
)
verbose_name_plural
=
_
(
'blacklist items'
)
ordering
=
(
'id'
,
)
def
get_absolute_url
(
self
):
def
get_absolute_url
(
self
):
return
reverse
(
'network.blacklist'
,
kwargs
=
{
'pk'
:
self
.
pk
})
return
reverse
(
'network.blacklist'
,
kwargs
=
{
'pk'
:
self
.
pk
})
...
...
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