Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gutyán Gábor
/
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
e13ef09d
authored
Sep 09, 2013
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
network: success messages are now unicode strings
parent
c33bf1e9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
24 deletions
+24
-24
circle/network/views.py
+24
-24
No files found.
circle/network/views.py
View file @
e13ef09d
...
@@ -86,7 +86,7 @@ class BlacklistDetail(UpdateView, SuccessMessageMixin):
...
@@ -86,7 +86,7 @@ class BlacklistDetail(UpdateView, SuccessMessageMixin):
model
=
Blacklist
model
=
Blacklist
template_name
=
"network/blacklist-edit.html"
template_name
=
"network/blacklist-edit.html"
form_class
=
BlacklistForm
form_class
=
BlacklistForm
success_message
=
_
(
'Successfully modified blacklist '
success_message
=
_
(
u
'Successfully modified blacklist '
'
%(ipv4)
s -
%(type)
s!'
)
'
%(ipv4)
s -
%(type)
s!'
)
def
get_success_url
(
self
):
def
get_success_url
(
self
):
...
@@ -103,7 +103,7 @@ class BlacklistCreate(CreateView, SuccessMessageMixin):
...
@@ -103,7 +103,7 @@ class BlacklistCreate(CreateView, SuccessMessageMixin):
model
=
Blacklist
model
=
Blacklist
template_name
=
"network/blacklist-create.html"
template_name
=
"network/blacklist-create.html"
form_class
=
BlacklistForm
form_class
=
BlacklistForm
success_message
=
_
(
'Successfully created blacklist '
success_message
=
_
(
u
'Successfully created blacklist '
'
%(ipv4)
s -
%(type)
s!'
)
'
%(ipv4)
s -
%(type)
s!'
)
...
@@ -140,7 +140,7 @@ class DomainDetail(UpdateView, SuccessMessageMixin):
...
@@ -140,7 +140,7 @@ class DomainDetail(UpdateView, SuccessMessageMixin):
model
=
Domain
model
=
Domain
template_name
=
"network/domain-edit.html"
template_name
=
"network/domain-edit.html"
form_class
=
DomainForm
form_class
=
DomainForm
success_message
=
_
(
'Successfully modified domain
%(name)
s!'
)
success_message
=
_
(
u
'Successfully modified domain
%(name)
s!'
)
def
get_success_url
(
self
):
def
get_success_url
(
self
):
if
'pk'
in
self
.
kwargs
:
if
'pk'
in
self
.
kwargs
:
...
@@ -160,7 +160,7 @@ class DomainCreate(CreateView, SuccessMessageMixin):
...
@@ -160,7 +160,7 @@ class DomainCreate(CreateView, SuccessMessageMixin):
model
=
Domain
model
=
Domain
template_name
=
"network/domain-create.html"
template_name
=
"network/domain-create.html"
form_class
=
DomainForm
form_class
=
DomainForm
success_message
=
_
(
'Successfully created domain
%(name)
s!'
)
success_message
=
_
(
u
'Successfully created domain
%(name)
s!'
)
class
DomainDelete
(
DeleteView
):
class
DomainDelete
(
DeleteView
):
...
@@ -177,11 +177,11 @@ class DomainDelete(DeleteView):
...
@@ -177,11 +177,11 @@ class DomainDelete(DeleteView):
def
delete
(
self
,
request
,
*
args
,
**
kwargs
):
def
delete
(
self
,
request
,
*
args
,
**
kwargs
):
self
.
object
=
self
.
get_object
()
self
.
object
=
self
.
get_object
()
if
unicode
(
self
.
object
)
!=
request
.
POST
.
get
(
'confirm'
):
if
unicode
(
self
.
object
)
!=
request
.
POST
.
get
(
'confirm'
):
messages
.
error
(
request
,
_
(
"Object name does not match!"
))
messages
.
error
(
request
,
_
(
u
"Object name does not match!"
))
return
self
.
get
(
request
,
*
args
,
**
kwargs
)
return
self
.
get
(
request
,
*
args
,
**
kwargs
)
response
=
super
(
DomainDelete
,
self
)
.
delete
(
request
,
*
args
,
**
kwargs
)
response
=
super
(
DomainDelete
,
self
)
.
delete
(
request
,
*
args
,
**
kwargs
)
messages
.
success
(
request
,
_
(
"Domain successfully deleted!"
))
messages
.
success
(
request
,
_
(
u
"Domain successfully deleted!"
))
return
response
return
response
def
get_context_data
(
self
,
**
kwargs
):
def
get_context_data
(
self
,
**
kwargs
):
...
@@ -230,14 +230,14 @@ class GroupCreate(CreateView, SuccessMessageMixin):
...
@@ -230,14 +230,14 @@ class GroupCreate(CreateView, SuccessMessageMixin):
model
=
Group
model
=
Group
template_name
=
"network/group-create.html"
template_name
=
"network/group-create.html"
form_class
=
GroupForm
form_class
=
GroupForm
success_message
=
_
(
'Successfully created host group
%(name)
s!'
)
success_message
=
_
(
u
'Successfully created host group
%(name)
s!'
)
class
GroupDetail
(
UpdateView
,
SuccessMessageMixin
):
class
GroupDetail
(
UpdateView
,
SuccessMessageMixin
):
model
=
Group
model
=
Group
template_name
=
"network/group-edit.html"
template_name
=
"network/group-edit.html"
form_class
=
GroupForm
form_class
=
GroupForm
success_message
=
_
(
'Successfully modified host group
%(name)
s!'
)
success_message
=
_
(
u
'Successfully modified host group
%(name)
s!'
)
def
get_success_url
(
self
):
def
get_success_url
(
self
):
if
'pk'
in
self
.
kwargs
:
if
'pk'
in
self
.
kwargs
:
...
@@ -287,7 +287,7 @@ class HostDetail(UpdateView, SuccessMessageMixin):
...
@@ -287,7 +287,7 @@ class HostDetail(UpdateView, SuccessMessageMixin):
model
=
Host
model
=
Host
template_name
=
"network/host-edit.html"
template_name
=
"network/host-edit.html"
form_class
=
HostForm
form_class
=
HostForm
success_message
=
_
(
'Successfully modified host
%(hostname)
s!'
)
success_message
=
_
(
u
'Successfully modified host
%(hostname)
s!'
)
def
get
(
self
,
request
,
*
args
,
**
kwargs
):
def
get
(
self
,
request
,
*
args
,
**
kwargs
):
if
request
.
is_ajax
():
if
request
.
is_ajax
():
...
@@ -351,7 +351,7 @@ class HostCreate(CreateView, SuccessMessageMixin):
...
@@ -351,7 +351,7 @@ class HostCreate(CreateView, SuccessMessageMixin):
model
=
Host
model
=
Host
template_name
=
"network/host-create.html"
template_name
=
"network/host-create.html"
form_class
=
HostForm
form_class
=
HostForm
success_message
=
_
(
'Successfully created host
%(hostname)
s!'
)
success_message
=
_
(
u
'Successfully created host
%(hostname)
s!'
)
class
HostDelete
(
DeleteView
):
class
HostDelete
(
DeleteView
):
...
@@ -383,11 +383,11 @@ class HostDelete(DeleteView):
...
@@ -383,11 +383,11 @@ class HostDelete(DeleteView):
def
delete
(
self
,
request
,
*
args
,
**
kwargs
):
def
delete
(
self
,
request
,
*
args
,
**
kwargs
):
self
.
object
=
self
.
get_object
()
self
.
object
=
self
.
get_object
()
if
unicode
(
self
.
object
)
!=
request
.
POST
.
get
(
'confirm'
):
if
unicode
(
self
.
object
)
!=
request
.
POST
.
get
(
'confirm'
):
messages
.
error
(
request
,
_
(
"Object name does not match!"
))
messages
.
error
(
request
,
_
(
u
"Object name does not match!"
))
return
self
.
get
(
request
,
*
args
,
**
kwargs
)
return
self
.
get
(
request
,
*
args
,
**
kwargs
)
response
=
super
(
HostDelete
,
self
)
.
delete
(
request
,
*
args
,
**
kwargs
)
response
=
super
(
HostDelete
,
self
)
.
delete
(
request
,
*
args
,
**
kwargs
)
messages
.
success
(
request
,
_
(
"Host successfully deleted!"
))
messages
.
success
(
request
,
_
(
u
"Host successfully deleted!"
))
return
response
return
response
...
@@ -403,7 +403,7 @@ class RecordDetail(UpdateView, SuccessMessageMixin):
...
@@ -403,7 +403,7 @@ class RecordDetail(UpdateView, SuccessMessageMixin):
template_name
=
"network/record-edit.html"
template_name
=
"network/record-edit.html"
form_class
=
RecordForm
form_class
=
RecordForm
# TODO fqdn
# TODO fqdn
success_message
=
_
(
'Successfully modified record!'
)
success_message
=
_
(
u
'Successfully modified record!'
)
def
get_context_data
(
self
,
**
kwargs
):
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
RecordDetail
,
self
)
.
get_context_data
(
**
kwargs
)
context
=
super
(
RecordDetail
,
self
)
.
get_context_data
(
**
kwargs
)
...
@@ -421,7 +421,7 @@ class RecordCreate(CreateView, SuccessMessageMixin):
...
@@ -421,7 +421,7 @@ class RecordCreate(CreateView, SuccessMessageMixin):
template_name
=
"network/record-create.html"
template_name
=
"network/record-create.html"
form_class
=
RecordForm
form_class
=
RecordForm
# TODO fqdn
# TODO fqdn
success_message
=
_
(
'Successfully created record!'
)
success_message
=
_
(
u
'Successfully created record!'
)
class
RecordDelete
(
DeleteView
):
class
RecordDelete
(
DeleteView
):
...
@@ -447,7 +447,7 @@ class RuleDetail(UpdateView, SuccessMessageMixin):
...
@@ -447,7 +447,7 @@ class RuleDetail(UpdateView, SuccessMessageMixin):
model
=
Rule
model
=
Rule
template_name
=
"network/rule-edit.html"
template_name
=
"network/rule-edit.html"
form_class
=
RuleForm
form_class
=
RuleForm
success_message
=
_
(
'Successfully modified rule!'
)
success_message
=
_
(
u
'Successfully modified rule!'
)
def
get_success_url
(
self
):
def
get_success_url
(
self
):
if
'pk'
in
self
.
kwargs
:
if
'pk'
in
self
.
kwargs
:
...
@@ -466,7 +466,7 @@ class RuleCreate(CreateView, SuccessMessageMixin):
...
@@ -466,7 +466,7 @@ class RuleCreate(CreateView, SuccessMessageMixin):
model
=
Rule
model
=
Rule
template_name
=
"network/rule-create.html"
template_name
=
"network/rule-create.html"
form_class
=
RuleForm
form_class
=
RuleForm
success_message
=
_
(
'Successfully created rule!'
)
success_message
=
_
(
u
'Successfully created rule!'
)
class
RuleDelete
(
DeleteView
):
class
RuleDelete
(
DeleteView
):
...
@@ -494,7 +494,7 @@ class VlanDetail(UpdateView, SuccessMessageMixin):
...
@@ -494,7 +494,7 @@ class VlanDetail(UpdateView, SuccessMessageMixin):
form_class
=
VlanForm
form_class
=
VlanForm
slug_field
=
'vid'
slug_field
=
'vid'
slug_url_kwarg
=
'vid'
slug_url_kwarg
=
'vid'
success_message
=
_
(
'Succesfully modified vlan
%(name)
s!'
)
success_message
=
_
(
u
'Succesfully modified vlan
%(name)
s!'
)
def
get_context_data
(
self
,
**
kwargs
):
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
VlanDetail
,
self
)
.
get_context_data
(
**
kwargs
)
context
=
super
(
VlanDetail
,
self
)
.
get_context_data
(
**
kwargs
)
...
@@ -510,7 +510,7 @@ class VlanCreate(CreateView, SuccessMessageMixin):
...
@@ -510,7 +510,7 @@ class VlanCreate(CreateView, SuccessMessageMixin):
model
=
Vlan
model
=
Vlan
template_name
=
"network/vlan-create.html"
template_name
=
"network/vlan-create.html"
form_class
=
VlanForm
form_class
=
VlanForm
success_message
=
_
(
'Successfully created vlan
%(name)
s!'
)
success_message
=
_
(
u
'Successfully created vlan
%(name)
s!'
)
class
VlanDelete
(
DeleteView
):
class
VlanDelete
(
DeleteView
):
...
@@ -531,11 +531,11 @@ class VlanDelete(DeleteView):
...
@@ -531,11 +531,11 @@ class VlanDelete(DeleteView):
def
delete
(
self
,
request
,
*
args
,
**
kwargs
):
def
delete
(
self
,
request
,
*
args
,
**
kwargs
):
self
.
object
=
self
.
get_object
()
self
.
object
=
self
.
get_object
()
if
unicode
(
self
.
object
)
!=
request
.
POST
.
get
(
'confirm'
):
if
unicode
(
self
.
object
)
!=
request
.
POST
.
get
(
'confirm'
):
messages
.
error
(
request
,
_
(
"Object name does not match!"
))
messages
.
error
(
request
,
_
(
u
"Object name does not match!"
))
return
self
.
get
(
request
,
*
args
,
**
kwargs
)
return
self
.
get
(
request
,
*
args
,
**
kwargs
)
response
=
super
(
VlanDelete
,
self
)
.
delete
(
request
,
*
args
,
**
kwargs
)
response
=
super
(
VlanDelete
,
self
)
.
delete
(
request
,
*
args
,
**
kwargs
)
messages
.
success
(
request
,
_
(
"Vlan successfully deleted!"
))
messages
.
success
(
request
,
_
(
u
"Vlan successfully deleted!"
))
return
response
return
response
def
get_context_data
(
self
,
**
kwargs
):
def
get_context_data
(
self
,
**
kwargs
):
...
@@ -575,7 +575,7 @@ class VlanGroupDetail(UpdateView, SuccessMessageMixin):
...
@@ -575,7 +575,7 @@ class VlanGroupDetail(UpdateView, SuccessMessageMixin):
template_name
=
"network/vlan-group-edit.html"
template_name
=
"network/vlan-group-edit.html"
form_class
=
VlanGroupForm
form_class
=
VlanGroupForm
success_url
=
reverse_lazy
(
'network.vlan_group_list'
)
success_url
=
reverse_lazy
(
'network.vlan_group_list'
)
success_message
=
_
(
'Successfully modified vlan group
%(name)
s!'
)
success_message
=
_
(
u
'Successfully modified vlan group
%(name)
s!'
)
def
get_context_data
(
self
,
*
args
,
**
kwargs
):
def
get_context_data
(
self
,
*
args
,
**
kwargs
):
context
=
super
(
VlanGroupDetail
,
self
)
.
get_context_data
(
**
kwargs
)
context
=
super
(
VlanGroupDetail
,
self
)
.
get_context_data
(
**
kwargs
)
...
@@ -587,7 +587,7 @@ class VlanGroupCreate(CreateView, SuccessMessageMixin):
...
@@ -587,7 +587,7 @@ class VlanGroupCreate(CreateView, SuccessMessageMixin):
model
=
VlanGroup
model
=
VlanGroup
template_name
=
"network/vlan-group-create.html"
template_name
=
"network/vlan-group-create.html"
form_class
=
VlanGroupForm
form_class
=
VlanGroupForm
success_message
=
_
(
'Successfully created vlan group
%(name)
s!'
)
success_message
=
_
(
u
'Successfully created vlan group
%(name)
s!'
)
class
VlanGroupDelete
(
DeleteView
):
class
VlanGroupDelete
(
DeleteView
):
...
@@ -619,7 +619,7 @@ def remove_host_group(request, **kwargs):
...
@@ -619,7 +619,7 @@ def remove_host_group(request, **kwargs):
elif
request
.
method
==
"POST"
:
elif
request
.
method
==
"POST"
:
host
.
groups
.
remove
(
group
)
host
.
groups
.
remove
(
group
)
if
not
request
.
is_ajax
():
if
not
request
.
is_ajax
():
messages
.
success
(
request
,
_
(
"Successfully removed
%(host)
s from "
messages
.
success
(
request
,
_
(
u
"Successfully removed
%(host)
s from "
"
%(group)
s group!"
%
{
"
%(group)
s group!"
%
{
'host'
:
host
,
'host'
:
host
,
'group'
:
group
'group'
:
group
...
@@ -635,7 +635,7 @@ def add_host_group(request, **kwargs):
...
@@ -635,7 +635,7 @@ def add_host_group(request, **kwargs):
group
=
Group
.
objects
.
get
(
pk
=
group_pk
)
group
=
Group
.
objects
.
get
(
pk
=
group_pk
)
host
.
groups
.
add
(
group
)
host
.
groups
.
add
(
group
)
if
not
request
.
is_ajax
():
if
not
request
.
is_ajax
():
messages
.
success
(
request
,
_
(
"Successfully added
%(host)
s to group"
messages
.
success
(
request
,
_
(
u
"Successfully added
%(host)
s to group"
"
%(group)
s!"
%
{
"
%(group)
s!"
%
{
'host'
:
host
,
'host'
:
host
,
'group'
:
group
'group'
:
group
...
...
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