From 23ae0821aa2dad579e74a21a82be79bd16fde691 Mon Sep 17 00:00:00 2001
From: mancini <mancini@astron.nl>
Date: Thu, 21 Jul 2022 15:24:33 +0200
Subject: [PATCH] Fix template location and expand length of field

---
 .../migrations/0003_increase_filter_name.py   | 18 ++++++++++
 ldvspec/lofardata/models.py                   |  2 +-
 .../templates/{lofardata => }/base.html       |  0
 .../lofardata/templates/lofardata/index.html  |  2 +-
 .../templates/registration/login.html         | 36 +++++++++++++++++++
 ldvspec/lofardata/urls.py                     |  4 +--
 6 files changed, 57 insertions(+), 5 deletions(-)
 create mode 100644 ldvspec/lofardata/migrations/0003_increase_filter_name.py
 rename ldvspec/lofardata/templates/{lofardata => }/base.html (100%)
 create mode 100644 ldvspec/lofardata/templates/registration/login.html

diff --git a/ldvspec/lofardata/migrations/0003_increase_filter_name.py b/ldvspec/lofardata/migrations/0003_increase_filter_name.py
new file mode 100644
index 00000000..04e28a59
--- /dev/null
+++ b/ldvspec/lofardata/migrations/0003_increase_filter_name.py
@@ -0,0 +1,18 @@
+# Generated by Django 3.1.4 on 2022-07-21 13:21
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('lofardata', '0002_defines_dataproduct'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='dataproductfilter',
+            name='field',
+            field=models.CharField(max_length=100),
+        ),
+    ]
diff --git a/ldvspec/lofardata/models.py b/ldvspec/lofardata/models.py
index 882475e5..2c51cce1 100644
--- a/ldvspec/lofardata/models.py
+++ b/ldvspec/lofardata/models.py
@@ -63,6 +63,6 @@ class DataProduct(models.Model):
 
 
 class DataProductFilter(models.Model):
-    field = models.CharField(max_length=20)
+    field = models.CharField(max_length=100)
     name = models.CharField(max_length=20)
     lookup_type = models.CharField(max_length=100)
diff --git a/ldvspec/lofardata/templates/lofardata/base.html b/ldvspec/lofardata/templates/base.html
similarity index 100%
rename from ldvspec/lofardata/templates/lofardata/base.html
rename to ldvspec/lofardata/templates/base.html
diff --git a/ldvspec/lofardata/templates/lofardata/index.html b/ldvspec/lofardata/templates/lofardata/index.html
index f41e698a..92cd6d0b 100644
--- a/ldvspec/lofardata/templates/lofardata/index.html
+++ b/ldvspec/lofardata/templates/lofardata/index.html
@@ -1,4 +1,4 @@
-{% extends 'lofardata/base.html' %}
+{% extends 'lofardata/../base.html' %}
 {% load static %}
 
 {% block myBlock %}
diff --git a/ldvspec/lofardata/templates/registration/login.html b/ldvspec/lofardata/templates/registration/login.html
new file mode 100644
index 00000000..6ed19e3c
--- /dev/null
+++ b/ldvspec/lofardata/templates/registration/login.html
@@ -0,0 +1,36 @@
+{% extends 'lofardata/../base.html' %}
+
+{% load static %}
+
+{% block myBlock %}
+
+{% if form.errors %}
+<p>Your username and password didn't match. Please try again.</p>
+{% endif %}
+
+{% if next %}
+    {% if user.is_authenticated %}
+    <p>Your account doesn't have access to this page. To proceed,
+    please login with an account that has access.</p>
+    {% else %}
+    <p>Please login to see this page.</p>
+    {% endif %}
+{% endif %}
+
+<form class="form-signin" action="{% url 'login' %}" method="post" id="login-form">
+      {% csrf_token %}
+    <h2 class="form-signin-heading">{{ message }}</h2>
+    <label for="id_username" class="sr-only">Email address</label>
+    <input type="text" name="username" id="id_username" class="form-control" placeholder="User Name" required autofocus>
+    <label for="id_password" class="sr-only">Password</label>
+    <input type="password" name="password" id="id_password" class="form-control" placeholder="Password" required>
+    <div class="checkbox">
+      <label>
+        <input type="checkbox" value="remember-me"> Remember me
+      </label>
+    </div>
+    <button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button>
+</form>
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/ldvspec/lofardata/urls.py b/ldvspec/lofardata/urls.py
index 877dee28..e8fdbc8e 100644
--- a/ldvspec/lofardata/urls.py
+++ b/ldvspec/lofardata/urls.py
@@ -23,7 +23,5 @@ urlpatterns = [
         version="0.0.1"
     ), name='openapi-schema'),
     # GUI
-    #path('', views.IndexView.as_view(), name='index'),
     path('', views.index, name='index'),
-
-]
\ No newline at end of file
+]
-- 
GitLab