diff --git a/UpdateSSIS/__pycache__/__init__.cpython-37.pyc b/UpdateSSIS/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000..5f65a9c Binary files /dev/null and b/UpdateSSIS/__pycache__/__init__.cpython-37.pyc differ diff --git a/UpdateSSIS/__pycache__/settings.cpython-37.pyc b/UpdateSSIS/__pycache__/settings.cpython-37.pyc new file mode 100644 index 0000000..a852a70 Binary files /dev/null and b/UpdateSSIS/__pycache__/settings.cpython-37.pyc differ diff --git a/UpdateSSIS/__pycache__/urls.cpython-37.pyc b/UpdateSSIS/__pycache__/urls.cpython-37.pyc new file mode 100644 index 0000000..d24e39e Binary files /dev/null and b/UpdateSSIS/__pycache__/urls.cpython-37.pyc differ diff --git a/UpdateSSIS/__pycache__/wsgi.cpython-37.pyc b/UpdateSSIS/__pycache__/wsgi.cpython-37.pyc new file mode 100644 index 0000000..dd207c9 Binary files /dev/null and b/UpdateSSIS/__pycache__/wsgi.cpython-37.pyc differ diff --git a/UpdateSSIS/settings.py b/UpdateSSIS/settings.py index 7781366..94115de 100644 --- a/UpdateSSIS/settings.py +++ b/UpdateSSIS/settings.py @@ -37,6 +37,10 @@ INSTALLED_APPS = [ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + 'updateIt.apps.UpdateitConfig', + 'django_tables2', + 'django_filters', + 'bootstrap3', ] MIDDLEWARE = [ @@ -75,9 +79,15 @@ WSGI_APPLICATION = 'UpdateSSIS.wsgi.application' DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': BASE_DIR / 'db.sqlite3', - } + 'ENGINE': 'sql_server.pyodbc', + 'NAME': 'UDV_DENKER', + 'HOST': 'bi-dsa-udv\dsa', + 'PORT': '', + + 'OPTIONS': { + 'driver': 'ODBC Driver 13 for SQL Server', + }, + }, } diff --git a/UpdateSSIS/urls.py b/UpdateSSIS/urls.py index c3f4425..5c72b05 100644 --- a/UpdateSSIS/urls.py +++ b/UpdateSSIS/urls.py @@ -14,8 +14,11 @@ Including another URLconf 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ 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 = [ + path('updateIt/',include('updateIt.urls'), name='updateIt'), path('admin/', admin.site.urls), ] diff --git a/db.sqlite3 b/db.sqlite3 new file mode 100644 index 0000000..e69de29 diff --git a/updateIt/__init__.py b/updateIt/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/updateIt/__pycache__/__init__.cpython-37.pyc b/updateIt/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000..3400c2b Binary files /dev/null and b/updateIt/__pycache__/__init__.cpython-37.pyc differ diff --git a/updateIt/__pycache__/admin.cpython-37.pyc b/updateIt/__pycache__/admin.cpython-37.pyc new file mode 100644 index 0000000..3dda7ce Binary files /dev/null and b/updateIt/__pycache__/admin.cpython-37.pyc differ diff --git a/updateIt/__pycache__/apps.cpython-37.pyc b/updateIt/__pycache__/apps.cpython-37.pyc new file mode 100644 index 0000000..4eaf149 Binary files /dev/null and b/updateIt/__pycache__/apps.cpython-37.pyc differ diff --git a/updateIt/__pycache__/filters.cpython-37.pyc b/updateIt/__pycache__/filters.cpython-37.pyc new file mode 100644 index 0000000..3c47e64 Binary files /dev/null and b/updateIt/__pycache__/filters.cpython-37.pyc differ diff --git a/updateIt/__pycache__/models.cpython-37.pyc b/updateIt/__pycache__/models.cpython-37.pyc new file mode 100644 index 0000000..686f66f Binary files /dev/null and b/updateIt/__pycache__/models.cpython-37.pyc differ diff --git a/updateIt/__pycache__/tables.cpython-37.pyc b/updateIt/__pycache__/tables.cpython-37.pyc new file mode 100644 index 0000000..46a480d Binary files /dev/null and b/updateIt/__pycache__/tables.cpython-37.pyc differ diff --git a/updateIt/__pycache__/urls.cpython-37.pyc b/updateIt/__pycache__/urls.cpython-37.pyc new file mode 100644 index 0000000..0cb9c6f Binary files /dev/null and b/updateIt/__pycache__/urls.cpython-37.pyc differ diff --git a/updateIt/__pycache__/views.cpython-37.pyc b/updateIt/__pycache__/views.cpython-37.pyc new file mode 100644 index 0000000..b0965f8 Binary files /dev/null and b/updateIt/__pycache__/views.cpython-37.pyc differ diff --git a/updateIt/admin.py b/updateIt/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/updateIt/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/updateIt/apps.py b/updateIt/apps.py new file mode 100644 index 0000000..390b94b --- /dev/null +++ b/updateIt/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class UpdateitConfig(AppConfig): + name = 'updateIt' diff --git a/updateIt/filters.py b/updateIt/filters.py new file mode 100644 index 0000000..6b2511d --- /dev/null +++ b/updateIt/filters.py @@ -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"] \ No newline at end of file diff --git a/updateIt/migrations/0001_initial.py b/updateIt/migrations/0001_initial.py new file mode 100644 index 0000000..61643d4 --- /dev/null +++ b/updateIt/migrations/0001_initial.py @@ -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, + }, + ), + ] diff --git a/updateIt/migrations/__init__.py b/updateIt/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/updateIt/migrations/__pycache__/0001_initial.cpython-37.pyc b/updateIt/migrations/__pycache__/0001_initial.cpython-37.pyc new file mode 100644 index 0000000..3bab84d Binary files /dev/null and b/updateIt/migrations/__pycache__/0001_initial.cpython-37.pyc differ diff --git a/updateIt/migrations/__pycache__/0002_auto_20210301_2228.cpython-37.pyc b/updateIt/migrations/__pycache__/0002_auto_20210301_2228.cpython-37.pyc new file mode 100644 index 0000000..d15bf14 Binary files /dev/null and b/updateIt/migrations/__pycache__/0002_auto_20210301_2228.cpython-37.pyc differ diff --git a/updateIt/migrations/__pycache__/__init__.cpython-37.pyc b/updateIt/migrations/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000..3325194 Binary files /dev/null and b/updateIt/migrations/__pycache__/__init__.cpython-37.pyc differ diff --git a/updateIt/models.py b/updateIt/models.py new file mode 100644 index 0000000..e65c00f --- /dev/null +++ b/updateIt/models.py @@ -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. diff --git a/updateIt/requirements.txt b/updateIt/requirements.txt new file mode 100644 index 0000000..f880ab0 --- /dev/null +++ b/updateIt/requirements.txt @@ -0,0 +1,4 @@ +pip install django-mssql-backend +pip install django-bootstrap +pip install django-filter +pip install django-tables2 diff --git a/updateIt/tables.py b/updateIt/tables.py new file mode 100644 index 0000000..8ec1f30 --- /dev/null +++ b/updateIt/tables.py @@ -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"} \ No newline at end of file diff --git a/updateIt/templates/updateIt/detail.html b/updateIt/templates/updateIt/detail.html new file mode 100644 index 0000000..e6adef0 --- /dev/null +++ b/updateIt/templates/updateIt/detail.html @@ -0,0 +1,39 @@ + + + + + Liste af SSISProjekter + + + +

{{ ssispackage.SSISProject }}

+
+ {% csrf_token %} + + + + + + + + + + + + + + + + +
PackageName>PackageNameProperty
{{ ssispackage.PackageName }}{{ ssispackage.PackageNameProperty }}
TFSPath
+ {{ ssispackage.tfspath }}
+ +
+
+ +
+ Tilbage +
+ + + \ No newline at end of file diff --git a/updateIt/templates/updateIt/index.html b/updateIt/templates/updateIt/index.html new file mode 100644 index 0000000..89a17c5 --- /dev/null +++ b/updateIt/templates/updateIt/index.html @@ -0,0 +1,19 @@ +{# tutorial/templates/tutorial/people.html #} +{% load render_table from django_tables2 %} +{% load bootstrap3 %} + + + + Liste af SSISProjekter + + + + {% if filter %} +
+ {% bootstrap_form filter.form layout='inline' %} + {% bootstrap_button 'filter' %} +
+{% endif %} +{% render_table table 'django_tables2/bootstrap.html' %} + + \ No newline at end of file diff --git a/updateIt/tests.py b/updateIt/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/updateIt/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/updateIt/urls.py b/updateIt/urls.py new file mode 100644 index 0000000..19d9775 --- /dev/null +++ b/updateIt/urls.py @@ -0,0 +1,8 @@ +from django.urls import path + +from . import views +app_name='updateIt' +urlpatterns = [ + path('',views.FilteredssispackagesListView.as_view(),name="index"), + path('/',views.detail,name='detail'), +] \ No newline at end of file diff --git a/updateIt/views.py b/updateIt/views.py new file mode 100644 index 0000000..164be5d --- /dev/null +++ b/updateIt/views.py @@ -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.