Første release med alle filer

This commit is contained in:
Dennis Kerschus 2021-03-03 14:03:24 +01:00
parent 24cf2e284f
commit 3f25063003
32 changed files with 214 additions and 4 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -37,6 +37,10 @@ INSTALLED_APPS = [
'django.contrib.sessions', 'django.contrib.sessions',
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'updateIt.apps.UpdateitConfig',
'django_tables2',
'django_filters',
'bootstrap3',
] ]
MIDDLEWARE = [ MIDDLEWARE = [
@ -75,9 +79,15 @@ WSGI_APPLICATION = 'UpdateSSIS.wsgi.application'
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.sqlite3', 'ENGINE': 'sql_server.pyodbc',
'NAME': BASE_DIR / 'db.sqlite3', 'NAME': 'UDV_DENKER',
} 'HOST': 'bi-dsa-udv\dsa',
'PORT': '',
'OPTIONS': {
'driver': 'ODBC Driver 13 for SQL Server',
},
},
} }

View File

@ -14,8 +14,11 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
""" """
from django.contrib import admin from django.contrib import admin
from django.urls import path from django.urls import path,include
from updateIt.views import FilteredssispackagesListView
from updateIt.filters import ssispackagesFilter
urlpatterns = [ urlpatterns = [
path('updateIt/',include('updateIt.urls'), name='updateIt'),
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
] ]

0
db.sqlite3 Normal file
View File

0
updateIt/__init__.py Normal file
View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

3
updateIt/admin.py Normal file
View File

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

5
updateIt/apps.py Normal file
View File

@ -0,0 +1,5 @@
from django.apps import AppConfig
class UpdateitConfig(AppConfig):
name = 'updateIt'

8
updateIt/filters.py Normal file
View File

@ -0,0 +1,8 @@
import django_filters
from .models import ssispackages
class ssispackagesFilter(django_filters.FilterSet):
class Meta:
model = ssispackages
fields = ["SSISProject", "PackageName", "PackageNameProperty", "tfspath"]

View File

@ -0,0 +1,28 @@
# Generated by Django 3.1.7 on 2021-03-01 21:55
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='ssispackages',
fields=[
('tfspath', models.CharField(max_length=4000, primary_key=True, serialize=False)),
('PackageName', models.CharField(max_length=500)),
('PackageNameProperty', models.CharField(max_length=500)),
('mtts', models.DateTimeField()),
('SSISProject', models.CharField(max_length=200)),
],
options={
'db_table': 'ssispackages',
'managed': False,
},
),
]

View File

18
updateIt/models.py Normal file
View File

@ -0,0 +1,18 @@
from django.db import models
from django.urls import reverse
class ssispackages(models.Model):
id=models.IntegerField(primary_key=True),
tfspath=models.CharField(max_length=4000)
PackageName=models.CharField(max_length=500)
PackageNameProperty=models.CharField(max_length=500)
mtts=models.DateTimeField(null=False)
SSISProject=models.CharField(max_length=200)
ITPUpdate=models.BooleanField()
ITUUpdate=models.BooleanField()
def get_absolute_url(self):
return reverse('updateIt:detail', args=[self.pk])
class Meta:
db_table = "ssispackages"
# Create your models here.

View File

@ -0,0 +1,4 @@
pip install django-mssql-backend
pip install django-bootstrap
pip install django-filter
pip install django-tables2

12
updateIt/tables.py Normal file
View File

@ -0,0 +1,12 @@
import django_tables2 as tables
from .models import ssispackages
from django.urls import reverse
class ssispackagesTable(tables.Table):
SSISProject = tables.Column(linkify=True)
class Meta:
model = ssispackages
template_name="django_tables2/bootstrap.html"
fields = ("SSISProject", "PackageName", "PackageNameProperty", "tfspath", "ITPUpdate", "ITUUpdate")
row_attrs={"data-id": lambda record:record.pk}
attrs={"class": "deepblue"}

View File

@ -0,0 +1,39 @@
<!doctype html>
<html>
<head>
<title>Liste af SSISProjekter</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
</head>
<body>
<h1> {{ ssispackage.SSISProject }}</h1>
<form action=" {% url 'updateIt:detail' ssispackage.id %} " method="get">
{% csrf_token %}
<table class="table table-bordered table-sm" style="width: 400px">
<thead class="thead-dark">
<th scope="col">PackageName></th><th scope="col">PackageNameProperty</th>
</thead>
<tbody>
<tr scope="row">
<td>{{ ssispackage.PackageName }}</td>
<td>{{ ssispackage.PackageNameProperty }}</td>
</tr>
<tr scope="row">
<td colspan=2>TFSPath<br>
{{ ssispackage.tfspath }}</td>
</tr>
<tr scope="row">
<td colspan=2><input type="checkbox" name="ITPUpdate" id="ITPUpdate" value="True" {% if ssispackage.ITPUpdate == True %}checked{% endif %}>
<label for="ITPUpdate">IT-Platform opdaterer</label>
<br><input type="checkbox" id="ITUUpdate" name="ITUUpdate" value="True" {% if ssispackage.ITUUpdate == True %}checked{% endif %}>
<label for="ITUUpdate">Udvikler opdaterer selv</label><br>
<input type="hidden" id="update" name="update" value="updated">
<input type="submit" value="Opdater"></td>
</tr>
</tbody>
</table>
<a href="../">Tilbage</a>
</form>
</body>
</html>

View File

@ -0,0 +1,19 @@
{# tutorial/templates/tutorial/people.html #}
{% load render_table from django_tables2 %}
{% load bootstrap3 %}
<!doctype html>
<html>
<head>
<title>Liste af SSISProjekter</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
</head>
<body>
{% if filter %}
<form action="" method="get" class="form form-inline">
{% bootstrap_form filter.form layout='inline' %}
{% bootstrap_button 'filter' %}
</form>
{% endif %}
{% render_table table 'django_tables2/bootstrap.html' %}
</body>
</html>

3
updateIt/tests.py Normal file
View File

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

8
updateIt/urls.py Normal file
View File

@ -0,0 +1,8 @@
from django.urls import path
from . import views
app_name='updateIt'
urlpatterns = [
path('',views.FilteredssispackagesListView.as_view(),name="index"),
path('<int:ssispackages_id>/',views.detail,name='detail'),
]

50
updateIt/views.py Normal file
View File

@ -0,0 +1,50 @@
from django.shortcuts import render, get_object_or_404
from django.http import HttpResponse
from .models import ssispackages
from django.template import loader
from django.views.generic import ListView
from .tables import ssispackagesTable
from django_tables2 import SingleTableView
from django_filters.views import FilterView
from .filters import ssispackagesFilter
from django.http import request
import logging,sys
class FilteredssispackagesListView(SingleTableView,FilterView):
model = ssispackages
table_class = ssispackagesTable
filterset_class = ssispackagesFilter
template_name = 'updateIt/index.html'
def detail(request, ssispackages_id):
ssispackage= get_object_or_404(ssispackages, pk=ssispackages_id)
# logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
updated="False"
try:
updated=request.GET['update']
except:
updated="False"
try:
a = request.GET['ITPUpdate']
except:
a=False
try:
b = request.GET['ITUUpdate']
except:
b=False
if updated=="updated" and ssispackage.ITPUpdate!=a:
ssispackage.ITPUpdate=bool(a)
if updated=="updated" and ssispackage.ITUUpdate!=b:
ssispackage.ITUUpdate=bool(b)
if updated=="updated":
ssispackage.save()
return render(request, 'updateIt/detail.html', {'ssispackage': ssispackage})
# def index(request):
# list_ssispackages = ssispackages.objects.order_by('-PackageName')
# context = {
# 'list_ssispackages': list_ssispackages
# }
# return render(request,'updateIt/index.html', context)
# Create your views here.