Commit 55430047 by Szabolcs Gelencser

fix login page html

parent af853c19
No preview for this file type
...@@ -64,6 +64,7 @@ def handler403(request): ...@@ -64,6 +64,7 @@ def handler403(request):
return resp return resp
#TODO: something like this for quotas?
class CreateLimitedResourceMixin(object): class CreateLimitedResourceMixin(object):
resource_name = None resource_name = None
model = None model = None
......
{% extends "dashboard/base.html" %} {% extends "registration/base.html" %}
{% load staticfiles %}
{% load i18n %} {% load i18n %}
{% block title-page %}{% trans "Virtual machines" %}{% endblock %} {% block title-page %}{% trans "Login" %}{% endblock %}
{% block content %} {% block extra_link %}
{% include "open-graph.html" %}
{% endblock %}
<form method="POST"> {% block content_box %}
<div class="row">
{% if form.password.errors or form.username.errors %}
<div class="login-form-errors">
{% include "display-form-errors.html" %}
</div>
{% endif %}
<div class="col-xs-{% if saml2 %}6{% else %}12{% endif %}">
<div class="login-form">
<form method="POST">
{% csrf_token %} {% csrf_token %}
<div class="input-group"> <div class="input-group">
<span class="input-group-addon"> <span class="input-group-addon">
...@@ -21,7 +31,14 @@ ...@@ -21,7 +31,14 @@
<input type="password" name="password" class="form-control"> <input type="password" name="password" class="form-control">
</div> </div>
<button type="submit" class="btn btn-success">Sign in</button> <button type="submit" class="btn btn-success">Sign in</button>
</form> </form>
</div>
</div>
{% if saml2 %}
<div class="col-xs-6">
<h4 style="padding-top: 0; margin-top: 20px;">{% trans "Login with SSO" %}</h4>
<a href="{% url "saml2_login" %}">{% trans "Click here!" %}</a>
</div>
{% endif %}
</div>
{% endblock %} {% endblock %}
...@@ -362,7 +362,6 @@ class VxlanSuperUserForm(ModelForm): ...@@ -362,7 +362,6 @@ class VxlanSuperUserForm(ModelForm):
'vlan', 'vlan',
'description', 'description',
'comment', 'comment',
'owner',
) )
), ),
FormActions( FormActions(
...@@ -374,7 +373,7 @@ class VxlanSuperUserForm(ModelForm): ...@@ -374,7 +373,7 @@ class VxlanSuperUserForm(ModelForm):
class Meta: class Meta:
model = Vxlan model = Vxlan
fields = ('name', 'vni', 'vlan', 'description', 'comment', 'owner', ) fields = ('name', 'vni', 'vlan', 'description', 'comment', )
class VxlanForm(ModelForm): class VxlanForm(ModelForm):
......
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2018-02-26 12:31
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('network', '0003_editorelement'),
]
operations = [
migrations.RemoveField(
model_name='vxlan',
name='owner',
),
]
...@@ -95,8 +95,6 @@ class Vxlan(models.Model): ...@@ -95,8 +95,6 @@ class Vxlan(models.Model):
'Notes, comments about the network')) 'Notes, comments about the network'))
created_at = models.DateTimeField(auto_now_add=True, created_at = models.DateTimeField(auto_now_add=True,
verbose_name=_('created at')) verbose_name=_('created at'))
owner = models.ForeignKey(User, blank=True, null=True,
verbose_name=_('owner'))
modified_at = models.DateTimeField(auto_now=True, modified_at = models.DateTimeField(auto_now=True,
verbose_name=_('modified at')) verbose_name=_('modified at'))
editor_elements = GenericRelation(EditorElement) editor_elements = GenericRelation(EditorElement)
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<div class="col-md-9 text-left"> <div class="col-md-9 text-left">
<h3 class="no-margin"><i class="fa fa-sitemap"></i> {% trans 'Editor' %}</h3> <h3 class="no-margin"><i class="fa fa-sitemap"></i> {% trans 'Editor' %}</h3>
</div> </div>
<div class="col-md-3 text-left"> <div class="col-md-3 text-right">
<button class="btn btn-success btn-xs" id="saveButton"><i class="fa fa-floppy-o"></i></button> <button class="btn btn-success btn-xs" id="saveButton"><i class="fa fa-floppy-o"></i></button>
</div> </div>
</div> </div>
......
...@@ -995,8 +995,7 @@ class VxlanDetail(LoginRequiredMixin, SuccessMessageMixin, UpdateView): #TODO: c ...@@ -995,8 +995,7 @@ class VxlanDetail(LoginRequiredMixin, SuccessMessageMixin, UpdateView): #TODO: c
return super(VxlanDetail, self).post(*args, **kwargs) return super(VxlanDetail, self).post(*args, **kwargs)
class VxlanCreate(LoginRequiredMixin, CreateLimitedResourceMixin, class VxlanCreate(LoginRequiredMixin, SuccessMessageMixin, InitialOwnerMixin, CreateView):
SuccessMessageMixin, InitialOwnerMixin, CreateView):
model = Vxlan model = Vxlan
profile_attribute = 'network_limit' profile_attribute = 'network_limit'
resource_name = _('Virtual network') resource_name = _('Virtual network')
...@@ -1032,7 +1031,6 @@ class VxlanCreate(LoginRequiredMixin, CreateLimitedResourceMixin, ...@@ -1032,7 +1031,6 @@ class VxlanCreate(LoginRequiredMixin, CreateLimitedResourceMixin,
def form_valid(self, form): def form_valid(self, form):
obj = form.save(commit=False) obj = form.save(commit=False)
obj.owner = self.request.user
obj.vlan = self.get_default_vlan() obj.vlan = self.get_default_vlan()
try: try:
obj.full_clean() obj.full_clean()
......
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