Commit 05bb3661 authored by Christophe Siraut's avatar Christophe Siraut

Fix reverse links. Thanks to Joan.

parent 2e622212
...@@ -33,6 +33,7 @@ class UserProfile(models.Model): ...@@ -33,6 +33,7 @@ class UserProfile(models.Model):
user = models.OneToOneField(User) user = models.OneToOneField(User)
email_notifications = models.BooleanField() email_notifications = models.BooleanField()
class Poll(models.Model): class Poll(models.Model):
# Override django id AutoField with randomly generated hash # Override django id AutoField with randomly generated hash
id = models.CharField( id = models.CharField(
......
...@@ -11,11 +11,14 @@ urlpatterns = patterns( ...@@ -11,11 +11,14 @@ urlpatterns = patterns(
login_required(UpdateView.as_view( login_required(UpdateView.as_view(
queryset=Poll.objects.all(), queryset=Poll.objects.all(),
form_class=PollForm, form_class=PollForm,
success_url='choices/'))), success_url='choices/')),
name="edit"),
url(r'^(?P<poll_id>\w{4,6})/$', url(r'^(?P<poll_id>\w{4,6})/$',
'meetingpoll.views.vote', 'meetingpoll.views.vote',
name='meetingpoll'), name='meetingpoll'),
url(r'^(?P<poll_id>\w{4,6})/delete/$', 'meetingpoll.views.delete'), url(r'^(?P<poll_id>\w{4,6})/delete/$',
'meetingpoll.views.delete',
name="delete"),
url(r'^(?P<poll_id>\w{4,6})/edit/choices/$', url(r'^(?P<poll_id>\w{4,6})/edit/choices/$',
'meetingpoll.views.editchoices', 'meetingpoll.views.editchoices',
name='choices'), name='choices'),
......
...@@ -26,8 +26,7 @@ urlpatterns = patterns('', ...@@ -26,8 +26,7 @@ urlpatterns = patterns('',
name='languages'), name='languages'),
url(r'^accounts/profile/$', 'meetingpoll.views.profile', name='profile'), url(r'^accounts/profile/$', 'meetingpoll.views.profile', name='profile'),
url(r'^(?P<poll_id>\w{4,6})/$', url(r'^(?P<poll_id>\w{4,6})/$',
'meetingpoll.views.vote', 'meetingpoll.views.vote'),
name='meetingpoll'),
) )
urlpatterns += i18n_patterns('', urlpatterns += i18n_patterns('',
......
...@@ -31,9 +31,9 @@ ...@@ -31,9 +31,9 @@
{% if polls %} {% if polls %}
<ul> <ul>
{% for poll in polls %} {% for poll in polls %}
<li><a href="{{ poll.link }}">{{ poll.title }}</a> : <li><a href="{% url 'meetingpoll' poll.id %}">{{ poll.title }}</a> :
<a href="{{ poll.link }}edit/">{% trans "edit" %}</a> - <a href="{% url 'edit' poll.id %}">{% trans "edit" %}</a> -
<a href="{{ poll.link }}delete/" onclick="return confirm('{% trans "Are you sure you want to delete this poll?" %}');">{% trans "delete" %}</a></li> <a href="{% url 'delete' poll.id %}" onclick="return confirm('{% trans "Are you sure you want to delete this poll?" %}');">{% trans "delete" %}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
{% else %} {% else %}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment