Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
piks3l
Respect My Net
Commits
26f8acd8
Commit
26f8acd8
authored
Jul 05, 2011
by
stef
Browse files
[enh] no pagination for view, proper redir+msg for confirm, error if not to be activated
parent
4b17eeff
Changes
1
Hide whitespace changes
Inline
Side-by-side
bt/views.py
View file @
26f8acd8
...
...
@@ -89,7 +89,8 @@ def confirm(request, id, name=None):
if
c
:
c
.
key
=
''
c
.
save
()
return
HttpResponse
(
'<div class="confirm_thanks">Thank you for verifying your confirmation</div>'
)
messages
.
add_message
(
request
,
messages
.
INFO
,
_
(
'Thank you for verifying your confirmation'
))
return
HttpResponseRedirect
(
'/'
)
# Redirect after POST
def
sendverifymail
(
service
,
to
):
actid
=
hashlib
.
sha1
(
''
.
join
([
chr
(
randint
(
32
,
122
))
for
x
in
range
(
12
)])).
hexdigest
()
...
...
@@ -168,19 +169,11 @@ def index(request):
context_instance
=
RequestContext
(
request
))
def
list_violations
(
request
):
v_list
=
Violation
.
objects
.
filter
(
activationid
=
''
)
paginator
=
Paginator
(
v_list
,
25
)
page
=
request
.
GET
.
get
(
'page'
,
'1'
)
try
:
violations
=
paginator
.
page
(
page
)
except
PageNotAnInteger
:
violations
=
paginator
.
page
(
1
)
except
EmptyPage
:
violations
=
paginator
.
page
(
paginator
.
num_pages
)
violations
=
Violation
.
objects
.
filter
(
activationid
=
''
)
return
render_to_response
(
'list.html'
,
{
"violations"
:
violations
},
context_instance
=
RequestContext
(
request
))
def
view
(
request
,
id
):
v
=
get_object_or_404
(
Violation
,
pk
=
id
)
if
v
.
activationid
:
raise
Http404
return
render_to_response
(
'view.html'
,
{
'v'
:
v
,
},
context_instance
=
RequestContext
(
request
))
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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