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
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
Hide 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,
...
@@ -18,7 +18,8 @@ from .forms import (HostForm, VlanForm, DomainForm, GroupForm, RecordForm,
from
django.contrib
import
messages
from
django.contrib
import
messages
from
django.views.generic.edit
import
FormMixin
from
django.views.generic.edit
import
FormMixin
from
django.utils.translation
import
ugettext_lazy
as
_
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
from
itertools
import
chain
import
json
import
json
...
@@ -206,14 +207,26 @@ class DomainDelete(DeleteView):
...
@@ -206,14 +207,26 @@ class DomainDelete(DeleteView):
# records
# records
records
=
Record
.
objects
.
filter
(
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
:
if
len
(
records
)
>
0
:
deps
.
append
({
deps
.
append
({
'name'
:
'Records'
,
'name'
:
'Records
from hosts
'
,
'data'
:
records
'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
[
'deps'
]
=
deps
context
[
'confirmation'
]
=
True
context
[
'confirmation'
]
=
True
return
context
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