mirror of
https://github.com/status-im/cabot.git
synced 2025-02-24 10:28:06 +00:00
Add profile settings link and fix bug with profile settings
There seems to be a django bug when using RequestContext. Switch to using render method instead
This commit is contained in:
parent
a38de047d0
commit
245e871b87
@ -23,7 +23,7 @@ from django.utils.decorators import method_decorator
|
|||||||
from django.utils.timezone import utc
|
from django.utils.timezone import utc
|
||||||
from django.views.generic import (
|
from django.views.generic import (
|
||||||
DetailView, CreateView, UpdateView, ListView, DeleteView, TemplateView, View)
|
DetailView, CreateView, UpdateView, ListView, DeleteView, TemplateView, View)
|
||||||
from django.shortcuts import redirect
|
from django.shortcuts import redirect, render
|
||||||
from models import AlertPluginUserData
|
from models import AlertPluginUserData
|
||||||
from models import (
|
from models import (
|
||||||
StatusCheck, GraphiteStatusCheck, JenkinsStatusCheck, HttpStatusCheck, ICMPStatusCheck,
|
StatusCheck, GraphiteStatusCheck, JenkinsStatusCheck, HttpStatusCheck, ICMPStatusCheck,
|
||||||
@ -41,15 +41,14 @@ class LoginRequiredMixin(object):
|
|||||||
@login_required
|
@login_required
|
||||||
def subscriptions(request):
|
def subscriptions(request):
|
||||||
""" Simple list of all checks """
|
""" Simple list of all checks """
|
||||||
t = loader.get_template('cabotapp/subscriptions.html')
|
|
||||||
services = Service.objects.all()
|
services = Service.objects.all()
|
||||||
users = User.objects.filter(is_active=True)
|
users = User.objects.filter(is_active=True)
|
||||||
c = RequestContext(request, {
|
|
||||||
|
return render(request, 'cabotapp/subscriptions.html', {
|
||||||
'services': services,
|
'services': services,
|
||||||
'users': users,
|
'users': users,
|
||||||
'duty_officers': get_duty_officers(),
|
'duty_officers': get_duty_officers(),
|
||||||
})
|
})
|
||||||
return HttpResponse(t.render(c))
|
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@ -552,11 +551,10 @@ class UserProfileUpdateAlert(LoginRequiredMixin, View):
|
|||||||
form_model = get_object_form(type(plugin_userdata))
|
form_model = get_object_form(type(plugin_userdata))
|
||||||
form = form_model(instance=plugin_userdata)
|
form = form_model(instance=plugin_userdata)
|
||||||
|
|
||||||
c = RequestContext(request, {
|
return render(request, self.template.template.name, {
|
||||||
'form': form,
|
'form': form,
|
||||||
'alert_preferences': profile.user_data(),
|
'alert_preferences': profile.user_data(),
|
||||||
})
|
})
|
||||||
return HttpResponse(self.template.render(c))
|
|
||||||
|
|
||||||
def post(self, request, pk, alerttype):
|
def post(self, request, pk, alerttype):
|
||||||
profile = UserProfile.objects.get(user=pk)
|
profile = UserProfile.objects.get(user=pk)
|
||||||
|
@ -92,6 +92,9 @@
|
|||||||
<li>
|
<li>
|
||||||
<a href="{% url "admin:auth_user_add" %}"><i class="glyphicon glyphicon-user"></i> Add user</a>
|
<a href="{% url "admin:auth_user_add" %}"><i class="glyphicon glyphicon-user"></i> Add user</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="{% url "user-profile" user.id %}"><i class="glyphicon glyphicon-wrench"></i>Profile Settings</a>
|
||||||
|
</li>
|
||||||
<li class="divider"></li>
|
<li class="divider"></li>
|
||||||
<li>
|
<li>
|
||||||
<a href="{% url "admin:index" %}"><i class="glyphicon glyphicon-lock"></i> Django admin</a>
|
<a href="{% url "admin:index" %}"><i class="glyphicon glyphicon-lock"></i> Django admin</a>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user