Commit 1e26bc6e by Bach Dániel

dashboard: trivial fixes

parent cafadff8
...@@ -54,7 +54,9 @@ from .validators import connect_command_template_validator ...@@ -54,7 +54,9 @@ from .validators import connect_command_template_validator
logger = getLogger(__name__) logger = getLogger(__name__)
pwgen = User.objects.make_random_password
def pwgen():
return User.objects.make_random_password()
class Favourite(Model): class Favourite(Model):
......
...@@ -20,7 +20,7 @@ Do you want to perform the following operation on ...@@ -20,7 +20,7 @@ Do you want to perform the following operation on
<a class="btn btn-default" href="{{object.get_absolute_url}}" <a class="btn btn-default" href="{{object.get_absolute_url}}"
data-dismiss="modal">{% trans "Cancel" %}</a> data-dismiss="modal">{% trans "Cancel" %}</a>
<button class="btn btn-{{ opview.effect }} btn-op-form-send" type="submit" id="op-form-send"> <button class="btn btn-{{ opview.effect }} btn-op-form-send" type="submit" id="op-form-send">
{% if opview.icon %}<i class="fa fa-fw fa-{{opview.icon}}"></i> {% endif %}{{ op|capfirst }} {% if opview.icon %}<i class="fa fa-fw fa-{{opview.icon}}"></i> {% endif %}{{ op.name|capfirst }}
</button> </button>
</div> </div>
</form> </form>
...@@ -62,7 +62,7 @@ class GraphViewBase(LoginRequiredMixin, View): ...@@ -62,7 +62,7 @@ class GraphViewBase(LoginRequiredMixin, View):
metric = self.create_class(metric)(instance) metric = self.create_class(metric)(instance)
return HttpResponse(metric.get_graph(graphite_url, time), return HttpResponse(metric.get_graph(graphite_url, time),
mimetype="image/png") content_type="image/png")
def get_object(self, request, pk): def get_object(self, request, pk):
instance = self.model.objects.get(id=pk) instance = self.model.objects.get(id=pk)
......
...@@ -267,6 +267,9 @@ class UserCreationView(LoginRequiredMixin, PermissionRequiredMixin, ...@@ -267,6 +267,9 @@ class UserCreationView(LoginRequiredMixin, PermissionRequiredMixin,
template_name = 'dashboard/user-create.html' template_name = 'dashboard/user-create.html'
permission_required = "auth.add_user" permission_required = "auth.add_user"
def get_success_url(self):
reverse('dashboard.views.group-detail', args=[self.group.pk])
def get_group(self, group_pk): def get_group(self, group_pk):
self.group = get_object_or_404(Group, pk=group_pk) self.group = get_object_or_404(Group, pk=group_pk)
if not self.group.profile.has_level(self.request.user, 'owner'): if not self.group.profile.has_level(self.request.user, 'owner'):
......
...@@ -1135,7 +1135,7 @@ def get_vm_screenshot(request, pk): ...@@ -1135,7 +1135,7 @@ def get_vm_screenshot(request, pk):
# TODO handle this better # TODO handle this better
raise Http404() raise Http404()
return HttpResponse(image, mimetype="image/png") return HttpResponse(image, content_type="image/png")
class InstanceActivityDetail(CheckedDetailView): class InstanceActivityDetail(CheckedDetailView):
......
...@@ -46,11 +46,10 @@ from itertools import chain ...@@ -46,11 +46,10 @@ from itertools import chain
from dashboard.views import AclUpdateView from dashboard.views import AclUpdateView
from dashboard.forms import AclUserOrGroupAddForm from dashboard.forms import AclUserOrGroupAddForm
from django.utils import simplejson
try: try:
from django.http import JsonResponse from django.http import JsonResponse
except ImportError: except ImportError:
from django.utils import simplejson
class JsonResponse(HttpResponse): class JsonResponse(HttpResponse):
"""JSON response for Django < 1.7 """JSON response for Django < 1.7
https://gist.github.com/philippeowagner/3179eb475fe1795d6515 https://gist.github.com/philippeowagner/3179eb475fe1795d6515
......
...@@ -110,9 +110,8 @@ class VirtualMachineDescModel(BaseResourceConfigModel): ...@@ -110,9 +110,8 @@ class VirtualMachineDescModel(BaseResourceConfigModel):
"for hosting the VM."), "for hosting the VM."),
verbose_name=_("required traits")) verbose_name=_("required traits"))
system = TextField(verbose_name=_('operating system'), system = TextField(verbose_name=_('operating system'),
help_text=(_('Name of operating system in ' help_text=(_('Name of operating system in format like '
'format like "%s".') % '"Ubuntu 12.04 LTS Desktop amd64".')))
'Ubuntu 12.04 LTS Desktop amd64'))
tags = TaggableManager(blank=True, verbose_name=_("tags")) tags = TaggableManager(blank=True, verbose_name=_("tags"))
has_agent = BooleanField(verbose_name=_('has agent'), default=True, has_agent = BooleanField(verbose_name=_('has agent'), default=True,
help_text=_( help_text=_(
......
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 sign in to comment