diff --git a/cloud/__init__.py b/cloud/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cloud/__pycache__/__init__.cpython-38.pyc b/cloud/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..75f400b Binary files /dev/null and b/cloud/__pycache__/__init__.cpython-38.pyc differ diff --git a/cloud/__pycache__/admin.cpython-38.pyc b/cloud/__pycache__/admin.cpython-38.pyc new file mode 100644 index 0000000..38ef110 Binary files /dev/null and b/cloud/__pycache__/admin.cpython-38.pyc differ diff --git a/cloud/__pycache__/apps.cpython-38.pyc b/cloud/__pycache__/apps.cpython-38.pyc new file mode 100644 index 0000000..187429e Binary files /dev/null and b/cloud/__pycache__/apps.cpython-38.pyc differ diff --git a/cloud/__pycache__/forms.cpython-38.pyc b/cloud/__pycache__/forms.cpython-38.pyc new file mode 100644 index 0000000..87e0b86 Binary files /dev/null and b/cloud/__pycache__/forms.cpython-38.pyc differ diff --git a/cloud/__pycache__/models.cpython-38.pyc b/cloud/__pycache__/models.cpython-38.pyc new file mode 100644 index 0000000..e5dc4fd Binary files /dev/null and b/cloud/__pycache__/models.cpython-38.pyc differ diff --git a/cloud/__pycache__/urls.cpython-38.pyc b/cloud/__pycache__/urls.cpython-38.pyc new file mode 100644 index 0000000..54d3df9 Binary files /dev/null and b/cloud/__pycache__/urls.cpython-38.pyc differ diff --git a/cloud/__pycache__/views.cpython-38.pyc b/cloud/__pycache__/views.cpython-38.pyc new file mode 100644 index 0000000..0a875b8 Binary files /dev/null and b/cloud/__pycache__/views.cpython-38.pyc differ diff --git a/cloud/admin.py b/cloud/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/cloud/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/cloud/apps.py b/cloud/apps.py new file mode 100644 index 0000000..7545afe --- /dev/null +++ b/cloud/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class CloudConfig(AppConfig): + name = 'cloud' diff --git a/cloud/forms.py b/cloud/forms.py new file mode 100644 index 0000000..b4de77b --- /dev/null +++ b/cloud/forms.py @@ -0,0 +1,13 @@ +from django import forms +from django.forms import ModelForm +from .models import Data + +class CloudAddFileForm(forms.ModelForm): + + + class Meta: + model = Data + labels = { + "file" : "Datei hochladen", + } + fields = ['file'] diff --git a/cloud/migrations/0001_initial.py b/cloud/migrations/0001_initial.py new file mode 100644 index 0000000..fa0f215 --- /dev/null +++ b/cloud/migrations/0001_initial.py @@ -0,0 +1,28 @@ +# Generated by Django 3.0.2 on 2020-01-22 17:05 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion +import django.utils.timezone + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='Data', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('file', models.FileField(max_length=255, null=True, upload_to='')), + ('date_created', models.DateTimeField(default=django.utils.timezone.now)), + ('date_last_modified', models.DateTimeField(default=django.utils.timezone.now)), + ('owner', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)), + ], + ), + ] diff --git a/cloud/migrations/0002_data_agency.py b/cloud/migrations/0002_data_agency.py new file mode 100644 index 0000000..f46005c --- /dev/null +++ b/cloud/migrations/0002_data_agency.py @@ -0,0 +1,20 @@ +# Generated by Django 3.0.2 on 2020-01-22 17:10 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('users', '0012_auto_20200122_1705'), + ('cloud', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='data', + name='agency', + field=models.ForeignKey(default=None, on_delete=django.db.models.deletion.CASCADE, to='users.Agency'), + ), + ] diff --git a/cloud/migrations/0003_auto_20200122_1810.py b/cloud/migrations/0003_auto_20200122_1810.py new file mode 100644 index 0000000..42fed0e --- /dev/null +++ b/cloud/migrations/0003_auto_20200122_1810.py @@ -0,0 +1,19 @@ +# Generated by Django 3.0.2 on 2020-01-22 18:10 + +import cloud.models +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('cloud', '0002_data_agency'), + ] + + operations = [ + migrations.AlterField( + model_name='data', + name='file', + field=models.FileField(max_length=255, null=True, upload_to=cloud.models.user_directory_path), + ), + ] diff --git a/cloud/migrations/0004_data_subdir.py b/cloud/migrations/0004_data_subdir.py new file mode 100644 index 0000000..2c7eca4 --- /dev/null +++ b/cloud/migrations/0004_data_subdir.py @@ -0,0 +1,18 @@ +# Generated by Django 3.0.2 on 2020-01-22 18:36 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('cloud', '0003_auto_20200122_1810'), + ] + + operations = [ + migrations.AddField( + model_name='data', + name='subdir', + field=models.CharField(blank=True, default='', max_length=2000, null=True), + ), + ] diff --git a/cloud/migrations/__init__.py b/cloud/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cloud/migrations/__pycache__/0001_initial.cpython-38.pyc b/cloud/migrations/__pycache__/0001_initial.cpython-38.pyc new file mode 100644 index 0000000..d74b78b Binary files /dev/null and b/cloud/migrations/__pycache__/0001_initial.cpython-38.pyc differ diff --git a/cloud/migrations/__pycache__/0002_data_agency.cpython-38.pyc b/cloud/migrations/__pycache__/0002_data_agency.cpython-38.pyc new file mode 100644 index 0000000..5cd529f Binary files /dev/null and b/cloud/migrations/__pycache__/0002_data_agency.cpython-38.pyc differ diff --git a/cloud/migrations/__pycache__/0003_auto_20200122_1810.cpython-38.pyc b/cloud/migrations/__pycache__/0003_auto_20200122_1810.cpython-38.pyc new file mode 100644 index 0000000..abc79ff Binary files /dev/null and b/cloud/migrations/__pycache__/0003_auto_20200122_1810.cpython-38.pyc differ diff --git a/cloud/migrations/__pycache__/0004_data_subdir.cpython-38.pyc b/cloud/migrations/__pycache__/0004_data_subdir.cpython-38.pyc new file mode 100644 index 0000000..c9ce5e5 Binary files /dev/null and b/cloud/migrations/__pycache__/0004_data_subdir.cpython-38.pyc differ diff --git a/cloud/migrations/__pycache__/__init__.cpython-38.pyc b/cloud/migrations/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..1d337a9 Binary files /dev/null and b/cloud/migrations/__pycache__/__init__.cpython-38.pyc differ diff --git a/cloud/models.py b/cloud/models.py new file mode 100644 index 0000000..f910024 --- /dev/null +++ b/cloud/models.py @@ -0,0 +1,23 @@ +from django.db import models +from django.contrib.auth.models import User +from users.models import Agency +# Create your models here. +from django.db import models +from django.utils import timezone + + +def user_directory_path(instance, filename): + # file will be uploaded to MEDIA_ROOT/agency_// + return 'agency_{0}/{1}/{2}'.format(instance.agency.pk, instance.subdir, filename) + + +class Data(models.Model): + subdir = models.CharField(max_length=2000, default="", blank=True, null=True) + file = models.FileField(null=True, max_length=255, upload_to=user_directory_path) + date_created = models.DateTimeField(default = timezone.now) + date_last_modified = models.DateTimeField(default = timezone.now) + owner = models.ForeignKey(User, on_delete=models.PROTECT) + agency = models.ForeignKey(Agency, on_delete=models.CASCADE, default=None) + + def __str__(self): + return str(self.file.name) diff --git a/cloud/templates/cloud/cloud_main.html b/cloud/templates/cloud/cloud_main.html new file mode 100644 index 0000000..5c204f7 --- /dev/null +++ b/cloud/templates/cloud/cloud_main.html @@ -0,0 +1,51 @@ +{% extends "users/base.html" %} +{% load crispy_forms_tags %} +{% block content %} +
+

Dateien

+
+

+ Hier können Sie Dateien und Ordner für ihre Agentur verwalten. +

+
+ {% csrf_token %} + {{form.media}} + {{form|crispy}} +
+ +
+
+
+

+ {% if all_files %} + + + + + + + + + + + + {% for ele in all_files %} + + + + + + + + {% endfor %} + +
#NameEigentümerDatum
{{forloop.counter}}{{ele.file}}{{ele.owner.first_name}} {{ele.owner.last_name}}{{ele.date_created}}Optionen
+ {% else %} +

+ {% endif %} +

+
+
+{% endblock content %} diff --git a/cloud/tests.py b/cloud/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/cloud/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/cloud/urls.py b/cloud/urls.py new file mode 100644 index 0000000..646bc4f --- /dev/null +++ b/cloud/urls.py @@ -0,0 +1,6 @@ +from django.urls import path +from .views import CloudMain + +urlpatterns = [ + path('', CloudMain.as_view(template_name="cloud/cloud_main.html"), name='cloud-main'), +] diff --git a/cloud/views.py b/cloud/views.py new file mode 100644 index 0000000..18bc967 --- /dev/null +++ b/cloud/views.py @@ -0,0 +1,33 @@ +from django.shortcuts import render, redirect +from django.contrib.auth.mixins import LoginRequiredMixin +from django.views.generic import CreateView, ListView, UpdateView, DetailView, DeleteView +from django.contrib.auth.models import User +from django.contrib.auth.decorators import login_required +from django.views.generic import TemplateView +from .models import Data +from django.views.generic.edit import FormView +from .forms import CloudAddFileForm +from django.conf import settings +from django.core.files.storage import default_storage + +# Create your views here. + +class CloudMain(LoginRequiredMixin, FormView): + form_class = CloudAddFileForm + success_url = '/cloud/' + + + def form_valid(self, form): + form = CloudAddFileForm(self.request.POST, self.request.FILES['file']) + + tempdata = Data(file=self.request.FILES['file'], subdir="subdir1/subdir2", agency=self.request.user.profile.agency, owner=self.request.user) + tempdata.save() + return super().form_valid(form) + + + # Change context and return for template-data + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + all_files = Data.objects.filter(agency__pk=self.request.user.profile.agency.pk) + context.update({'active_link' : 'cloud', 'all_files': all_files}) + return context \ No newline at end of file diff --git a/digitaleagentur/__pycache__/settings.cpython-38.pyc b/digitaleagentur/__pycache__/settings.cpython-38.pyc index 12cc5b7..80ab527 100644 Binary files a/digitaleagentur/__pycache__/settings.cpython-38.pyc and b/digitaleagentur/__pycache__/settings.cpython-38.pyc differ diff --git a/digitaleagentur/__pycache__/urls.cpython-38.pyc b/digitaleagentur/__pycache__/urls.cpython-38.pyc index fe17211..b9fca1e 100644 Binary files a/digitaleagentur/__pycache__/urls.cpython-38.pyc and b/digitaleagentur/__pycache__/urls.cpython-38.pyc differ diff --git a/digitaleagentur/settings.py b/digitaleagentur/settings.py index a048ad8..bab2927 100644 --- a/digitaleagentur/settings.py +++ b/digitaleagentur/settings.py @@ -34,6 +34,7 @@ INSTALLED_APPS = [ 'users.apps.UsersConfig', 'areas.apps.AreasConfig', 'orga.apps.OrgaConfig', + 'cloud.apps.CloudConfig', 'tasks.apps.TasksConfig', 'quicklinks.apps.QuicklinksConfig', 'standards.apps.StandardsConfig', diff --git a/digitaleagentur/urls.py b/digitaleagentur/urls.py index 40fc5c6..f996bc3 100644 --- a/digitaleagentur/urls.py +++ b/digitaleagentur/urls.py @@ -31,6 +31,7 @@ urlpatterns = [ path('areas/', include('areas.urls'), name="areas-management"), path('tasks/', include('tasks.urls'), name="tasks-management"), path('ql/', include('quicklinks.urls'), name="ql-management"), + path('cloud/', include('cloud.urls'), name="cloud-main"), path('standards/', include('standards.urls'), name="standards"), path('news/', include('news.urls'), name="dashboard"), path('orga/', include('orga.urls'), name="orga"), diff --git a/media/agency_2/FeedbackWPU10.txt b/media/agency_2/FeedbackWPU10.txt new file mode 100644 index 0000000..bebf28b --- /dev/null +++ b/media/agency_2/FeedbackWPU10.txt @@ -0,0 +1,8 @@ +3D-Druck ++ Gute Struktur ++ Shortucts ++ Planemodellierung - Als VIdeo noch ein + +HTML +- Erweiterten Kurs + diff --git a/media/agency_2/subdir1/subdir2/FeedbackWPU10.txt b/media/agency_2/subdir1/subdir2/FeedbackWPU10.txt new file mode 100644 index 0000000..bebf28b --- /dev/null +++ b/media/agency_2/subdir1/subdir2/FeedbackWPU10.txt @@ -0,0 +1,8 @@ +3D-Druck ++ Gute Struktur ++ Shortucts ++ Planemodellierung - Als VIdeo noch ein + +HTML +- Erweiterten Kurs + diff --git a/media/agency_2/subdir1/subdir2/FeedbackWPU10_Ry9eQsX.txt b/media/agency_2/subdir1/subdir2/FeedbackWPU10_Ry9eQsX.txt new file mode 100644 index 0000000..bebf28b --- /dev/null +++ b/media/agency_2/subdir1/subdir2/FeedbackWPU10_Ry9eQsX.txt @@ -0,0 +1,8 @@ +3D-Druck ++ Gute Struktur ++ Shortucts ++ Planemodellierung - Als VIdeo noch ein + +HTML +- Erweiterten Kurs + diff --git a/news/__pycache__/models.cpython-38.pyc b/news/__pycache__/models.cpython-38.pyc index 8183686..9c74d84 100644 Binary files a/news/__pycache__/models.cpython-38.pyc and b/news/__pycache__/models.cpython-38.pyc differ diff --git a/news/templates/news/news_management.html b/news/templates/news/news_management.html index 617e9a6..baa7359 100644 --- a/news/templates/news/news_management.html +++ b/news/templates/news/news_management.html @@ -33,7 +33,7 @@
- +
@@ -74,14 +74,13 @@
Titel
+
@@ -115,7 +114,7 @@ {% endfor %} - +
Titel
@@ -124,6 +123,21 @@ {% endblock content %} diff --git a/standards/__pycache__/views.cpython-38.pyc b/standards/__pycache__/views.cpython-38.pyc index 28eb6ae..504f2af 100644 Binary files a/standards/__pycache__/views.cpython-38.pyc and b/standards/__pycache__/views.cpython-38.pyc differ diff --git a/standards/views.py b/standards/views.py index b0ec780..dfde738 100644 --- a/standards/views.py +++ b/standards/views.py @@ -22,7 +22,7 @@ class StandardsManagement(LoginRequiredMixin, ListView): # # Get all Users of the Same Agency as logged user areas = Areas.objects.filter(agency__pk=self.request.user.profile.agency.pk) standards_of_user = Standards.objects.filter(agency__pk=self.request.user.profile.agency.pk, created_standard_by=self.request.user.pk) - standards_of_agency = Standards.objects.filter(agency__pk=self.request.user.profile.agency.pk) + standards_of_agency = Standards.objects.filter(agency__pk=self.request.user.profile.agency.pk, public=True) unpubstandards_of_user = Standards.objects.filter(agency__pk=self.request.user.profile.agency.pk, public=False) tasks = Tasks.objects.filter(agency__pk=self.request.user.profile.agency.pk) context.update({'active_link' : 'standards', 'tasks': tasks, 'unpubstandards_of_user' : unpubstandards_of_user, 'standards_of_agency' : standards_of_agency, 'areas' : areas, 'standards_of_user' : standards_of_user}) diff --git a/users/static/users/css/custom.css b/users/static/users/css/custom.css index 4061ee7..8794599 100644 --- a/users/static/users/css/custom.css +++ b/users/static/users/css/custom.css @@ -59,7 +59,13 @@ body{ width: 200px; height: 200px; } - +/* + PAGINATION +*/ +.paginate_button_custom { + padding: 0px !important; + font-size: 2em; +} /* FOR TREE ORGA diff --git a/users/templates/users/base.html b/users/templates/users/base.html index e22da71..67919b1 100644 --- a/users/templates/users/base.html +++ b/users/templates/users/base.html @@ -20,11 +20,7 @@ - - - - @@ -38,7 +34,15 @@ - + + + + + + + + + @@ -120,6 +124,21 @@ + + + + {% if perms.users.users_usermanagement or perms.users.areas_management or perms.users.tasks_management or perms.user.news_management %} @@ -328,6 +347,14 @@ + + + + + + + +