diff --git a/requirements.txt b/requirements.txt index d954546..71b1305 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,10 +2,14 @@ Django==4.0 djangorestframework django-auth-ldap -fontawesome-free -django-mathfilters - psycopg2 + +django-bootstrap-v5 + +#fontawesome-free +#django-mathfilters + + ldap3 django-allauth django-compressor @@ -20,7 +24,7 @@ django-notifications-hq django-environ # PDF creating -django-hardcopy +#django-hardcopy # schema support pyyaml @@ -35,7 +39,7 @@ django-q redis jinja2 -python-gitlab +#python-gitlab dnspython git+https://github.com/ungleich/python-oca.git#egg=oca diff --git a/uncloud/settings.py b/uncloud/settings.py index 5c27c45..f7a16ce 100644 --- a/uncloud/settings.py +++ b/uncloud/settings.py @@ -61,6 +61,7 @@ INSTALLED_APPS = [ 'django.contrib.sites', 'django.contrib.staticfiles', 'django_extensions', + 'bootstrap5', # 'mathfilters', # 'compressor', # 'wkhtmltopdf', diff --git a/uncloud/templates/uncloud/base.html b/uncloud/templates/uncloud/base.html index 1be7eed..d0295ca 100644 --- a/uncloud/templates/uncloud/base.html +++ b/uncloud/templates/uncloud/base.html @@ -1,4 +1,11 @@ -{% load static i18n %} {% get_current_language as LANGUAGE_CODE %} +{% load static i18n %} +{% load bootstrap5 %} + +{# Display django.contrib.messages as Bootstrap alerts #} +{% bootstrap_messages %} + +{% get_current_language as LANGUAGE_CODE %} + @@ -11,19 +18,12 @@ uncloud - {% block title %} made in Switzerland {% endblock %} - - - - - {% block css_extra %} {% endblock css_extra %} - - + {# Load CSS and JavaScript #} + {% bootstrap_css %} + {% bootstrap_javascript %} + @@ -34,34 +34,27 @@ - + - {% block content %} {% endblock %} + {% block content %} {% endblock %} - - - {% block js_extra %} {% endblock js_extra %} diff --git a/uncloud/templates/uncloud/index.html b/uncloud/templates/uncloud/index.html index 0b3f0a7..5aeb112 100644 --- a/uncloud/templates/uncloud/index.html +++ b/uncloud/templates/uncloud/index.html @@ -19,7 +19,7 @@ some convience views provided by the Django Rest Framework. You can - freely access + freely access the source code of uncloud. This is a BETA service. As such, some functionality might not be very sophisticated. @@ -37,7 +37,7 @@
  • First you need to register an account. If you already have one, you can - login. + login.
  • If you have forgotten your password or other issues with logging in, you can contact the ungleich support via support at ungleich.ch. @@ -110,7 +110,6 @@
  • List your Bills
  • Make a payment or list your payments
  • Show your balance -
  • Show your VM Instances @@ -166,4 +165,4 @@ {% endif %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/uncloud/urls.py b/uncloud/urls.py index 64c453d..afb3a2e 100644 --- a/uncloud/urls.py +++ b/uncloud/urls.py @@ -3,7 +3,7 @@ The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.0/topics/http/urls/ """ -import environ + from django.contrib import admin from django.urls import path, include from django.conf import settings @@ -12,17 +12,15 @@ from django.conf.urls.static import static from rest_framework import routers from rest_framework.schemas import get_schema_view -#from opennebula import views as oneviews +from uncloud_auth import views as authviews from uncloud_net import views as netviews from uncloud_pay import views as payviews from uncloud_vm import views as vmviews +from . import views as uncloudviews #import notifications.urls router = routers.DefaultRouter() -env = environ.Env() -environ.Env.read_env() - # Beta endpoints router.register(r'beta/vm', vmviews.NicoVMProductViewSet, basename='nicovmproduct') @@ -46,6 +44,10 @@ router.register(r'v2/generic/vat-rate', payviews.VATRateViewSet, basename='vatra urlpatterns = [ + path(r'', uncloudviews.UncloudIndex.as_view(), name='uncloudindex'), + path(r'^/login', authviews.LoginView.as_view(), name='login'), + path(r'^/logout', authviews.LogoutView.as_view(), name='logout'), + path(r'api/', include(router.urls), name='api'), path('api-auth/', include('rest_framework.urls', namespace='rest_framework')), # for login to REST API diff --git a/uncloud_auth/templates/uncloud_auth/login.html b/uncloud_auth/templates/uncloud_auth/login.html index ea48bc1..7956687 100644 --- a/uncloud_auth/templates/uncloud_auth/login.html +++ b/uncloud_auth/templates/uncloud_auth/login.html @@ -1,5 +1,8 @@ {% extends 'uncloud/base.html' %} +{% load bootstrap5 %} +{% block title %}Welcome to uncloud [beta]{% endblock %} +{% block content %}
    @@ -15,4 +18,4 @@
    - +{% endblock %} diff --git a/uncloud_auth/views.py b/uncloud_auth/views.py index 9310a4c..6430be9 100644 --- a/uncloud_auth/views.py +++ b/uncloud_auth/views.py @@ -8,13 +8,11 @@ from rest_framework.response import Response from .serializers import * - class LoginView(auth_views.LoginView): template_name = 'uncloud_auth/login.html' class LogoutView(auth_views.LogoutView): pass -# template_name = 'uncloud_auth/logo.html' class UserViewSet(viewsets.GenericViewSet):