def can_upload_files(self):
return False
+ def is_a_super_user_or_staff(self):
+ return False
+
def true_if_is_super_or_staff(fn):
def decorated(self, *args, **kwargs):
return self.is_superuser or self.is_staff or fn(self, *args, **kwargs)
<p>{% trans "You are not subscribed to this question." %}</p>\r
{% endif %}\r
</div>\r
- <p><a class="ajax-command sidebar_button subscription_switch" href="{% url subscribe id=question.id %}">\r
+ <p><a class="ajax-command sidebar_button subscription_switch" href="{% url subscribe_simple id=question.id %}">\r
{% if subscription %}\r
{% trans "unsubscribe me" %}\r
{% else %}\r
url(r'^%s(?P<id>\d+)/' % _('flag/'), app.commands.flag_post, name='flag_post'),
url(r'^%s(?P<id>\d+)/' % _('delete/'), app.commands.delete_post, name='delete_post'),
url(r'^%s(?P<id>\d+)/(?P<user>\d+)?/$' % _('subscribe/'), app.commands.subscribe, name="subscribe"),
+ url(r'^%s(?P<id>\d+)/$' % _('subscribe/'), app.commands.subscribe, name="subscribe_simple"),
url(r'^%s' % _('matching_tags/'), app.commands.matching_tags, name='matching_tags'),
url(r'^%s(?P<id>\d+)/' % _('node_markdown/'), app.commands.node_markdown, name='node_markdown'),
url(r'^%s(?P<id>\d+)/' % _('convert/'), app.commands.convert_to_comment,
return RefreshPageCommand()
@decorate.withfn(command)
-def subscribe(request, id, user=0):
+def subscribe(request, id, user=None):
if user:
- user = User.objects.filter(id=user)[0]
- if not (user.is_a_super_user_or_staff() or user.is_authenticated()):
- raise CommandException(_("You do not have the correct credentials to preform this action."))
+ try:
+ user = User.objects.get(id=user)
+ except User.DoesNotExist:
+ raise Http404()
+ if not (request.user.is_a_super_user_or_staff() or user.is_authenticated()):
+ raise CommandException(_("You do not have the correct credentials to preform this action."))
else:
user = request.user