Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
36726958
authored
Sep 10, 2013
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
network: fix missing records when deleting domain
parent
16250135
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
circle/network/views.py
+16
-3
No files found.
circle/network/views.py
View file @
36726958
...
...
@@ -18,7 +18,8 @@ from .forms import (HostForm, VlanForm, DomainForm, GroupForm, RecordForm,
from
django.contrib
import
messages
from
django.views.generic.edit
import
FormMixin
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.db.models
import
Q
# from django.db.models import Q
from
operator
import
itemgetter
from
itertools
import
chain
import
json
...
...
@@ -206,14 +207,26 @@ class DomainDelete(DeleteView):
# records
records
=
Record
.
objects
.
filter
(
Q
(
domain
=
self
.
object
)
|
Q
(
host__in
=
deps
[
1
][
'data'
])
host__in
=
deps
[
1
][
'data'
]
# Q(domain=self.object) | (host__in=deps[1]['data'])
)
if
len
(
records
)
>
0
:
deps
.
append
({
'name'
:
'Records'
,
'name'
:
'Records
from hosts
'
,
'data'
:
records
})
records
=
Record
.
objects
.
filter
(
domain
=
self
.
object
)
if
len
(
records
)
>
0
:
# to filter out doubles (records from hosts and domains)
indexes
=
map
(
itemgetter
(
'name'
),
deps
)
n
=
indexes
.
index
(
'Records from hosts'
)
if
len
(
indexes
)
>
0
else
0
deps
.
append
({
'name'
:
'Records only from the domain'
,
'data'
:
records
.
exclude
(
pk__in
=
deps
[
n
][
'data'
])
if
n
>
0
else
records
})
context
[
'deps'
]
=
deps
context
[
'confirmation'
]
=
True
return
context
...
...
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