Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
etch
nuages
Commits
d411df30
Commit
d411df30
authored
Jun 27, 2010
by
christophe siraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ajouté la fonction "supprimer ses sondages"
parent
c435a179
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
2 deletions
+14
-2
sondage/views.py
sondage/views.py
+12
-0
templates/index.html
templates/index.html
+1
-1
urls.py
urls.py
+1
-1
No files found.
sondage/views.py
View file @
d411df30
...
...
@@ -121,6 +121,18 @@ def editchoices(request, poll_id):
vforms
=
OrderedItemFormset
(
instance
=
poll
)
return
render_to_response
(
'sondage/choice_form.html'
,
{
'object'
:
poll
,
'vforms'
:
vforms
,
'language_code'
:
language_code
,},
context_instance
=
RequestContext
(
request
))
@
login_required
def
delete
(
request
,
poll_id
):
poll
=
get_object_or_404
(
Poll
.
objects
.
all
(),
id
=
poll_id
)
if
poll
.
author
==
str
(
request
.
user
):
poll
.
delete
()
return
HttpResponseRedirect
(
'/'
)
def
make_buletin_form
(
poll
,
**
kwargs
):
return
[
[
VoteForm
(
prefix
=
choice
)
]
for
choice
in
Choice
.
objects
.
filter
(
poll
=
poll
.
id
)
]
...
...
templates/index.html
View file @
d411df30
...
...
@@ -37,7 +37,7 @@
{% ifequal object.author user.username %}
<li><a
href=
"{{ object.id }}"
>
{{ object.title }}
</a>
:
<a
href=
"{{ object.id }}/edit"
>
{% trans "edit" %}
</a>
-
<a
href=
"{{ object.id }}/delete"
>
{% trans "delete" %}
</a></li>
<a
href=
"{{ object.id }}/delete"
onclick=
"return confirm('{% trans "
Are
you
sure
you
want
to
delete
this
poll
?"
%}');"
>
{% trans "delete" %}
</a></li>
{% endifequal %}
{% endfor %}
...
...
urls.py
View file @
d411df30
...
...
@@ -34,7 +34,7 @@ urlpatterns = patterns('',
(
r
'^(?P<poll_id>\w{4})/$'
,
'nuages.sondage.views.vote'
),
(
r
'^new/$'
,
'nuages.sondage.views.new'
),
(
r
'^(?P<object_id>\w+)/edit/$'
,
'nuages.sondage.views.secure_update_object'
,
dict
(
poll_dict
,
post_save_redirect
=
'choices/'
)),
#
(r'^(?P<poll_id>\w+)/
edit
/$', 'nuage.sondage.views.
edit
'),
(
r
'^(?P<poll_id>\w+)/
delete
/$'
,
'nuage
s
.sondage.views.
delete
'
),
(
r
'^(?P<poll_id>\w+)/edit/choices/$'
,
'nuages.sondage.views.editchoices'
),
(
r
'^(?P<poll_id>\w{4})/vote/$'
,
'nuages.sondage.views.vote'
),
...
...
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