Standardbug behoben
This commit is contained in:
parent
82a23b9ddb
commit
281dc1cb54
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.
|
|
@ -0,0 +1,3 @@
|
|||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class CloudConfig(AppConfig):
|
||||
name = 'cloud'
|
||||
|
|
@ -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']
|
||||
|
|
@ -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)),
|
||||
],
|
||||
),
|
||||
]
|
||||
|
|
@ -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'),
|
||||
),
|
||||
]
|
||||
|
|
@ -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),
|
||||
),
|
||||
]
|
||||
|
|
@ -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),
|
||||
),
|
||||
]
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -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_<id>/<subdirs>/<filename>
|
||||
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)
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
{% extends "users/base.html" %}
|
||||
{% load crispy_forms_tags %}
|
||||
{% block content %}
|
||||
<div class="content-section col-12">
|
||||
<h3>Dateien</h3>
|
||||
<hr>
|
||||
<p>
|
||||
Hier können Sie Dateien und Ordner für ihre Agentur verwalten.
|
||||
</p>
|
||||
<form method="POST" id="fileuploadform" enctype="multipart/form-data" class="col-6">
|
||||
{% csrf_token %}
|
||||
{{form.media}}
|
||||
{{form|crispy}}
|
||||
<div class="mt-2">
|
||||
<button class="btn btn-primary" type="submit">Hochladen</button>
|
||||
</div>
|
||||
</form>
|
||||
<div class="mt-4">
|
||||
<p>
|
||||
{% if all_files %}
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col">Name</th>
|
||||
<th scope="col">Eigentümer</th>
|
||||
<th scope="col">Datum</th>
|
||||
<th scope="col"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for ele in all_files %}
|
||||
<tr>
|
||||
<td>{{forloop.counter}}</td>
|
||||
<td>{{ele.file}}</td>
|
||||
<td>{{ele.owner.first_name}} {{ele.owner.last_name}}</td>
|
||||
<td>{{ele.date_created}}</td>
|
||||
<td>Optionen</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<div class="alert alert-primary" role="alert">
|
||||
Für Ihre Agentur wurden noch keine Dateien hochgeladen.
|
||||
</div>
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock content %}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
|
|
@ -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'),
|
||||
]
|
||||
|
|
@ -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
|
||||
Binary file not shown.
Binary file not shown.
|
|
@ -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',
|
||||
|
|
|
|||
|
|
@ -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"),
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
3D-Druck
|
||||
+ Gute Struktur
|
||||
+ Shortucts
|
||||
+ Planemodellierung - Als VIdeo noch ein
|
||||
|
||||
HTML
|
||||
- Erweiterten Kurs
|
||||
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
3D-Druck
|
||||
+ Gute Struktur
|
||||
+ Shortucts
|
||||
+ Planemodellierung - Als VIdeo noch ein
|
||||
|
||||
HTML
|
||||
- Erweiterten Kurs
|
||||
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
3D-Druck
|
||||
+ Gute Struktur
|
||||
+ Shortucts
|
||||
+ Planemodellierung - Als VIdeo noch ein
|
||||
|
||||
HTML
|
||||
- Erweiterten Kurs
|
||||
|
||||
Binary file not shown.
|
|
@ -33,7 +33,7 @@
|
|||
<input class="form-control" id="tableSearch" size="50" type="text" placeholder="Suche in Tabelle...">
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover" >
|
||||
<table class="table table-hover" id="activenews" >
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Titel</th>
|
||||
|
|
@ -74,14 +74,13 @@
|
|||
</div>
|
||||
<div class="tab-pane fade" id="t_archiv" role="tabpanel" aria-labelledby="act">
|
||||
<h5 class="mt-3"><a href="" style="color: #000000;">Archivierte News</a></h5>
|
||||
<hr>
|
||||
|
||||
<hr>
|
||||
<div class="row">
|
||||
<div class="form-group mb-2">
|
||||
<input class="form-control" id="tableSearch_arch" size="50" type="text" placeholder="Suche in Tabelle...">
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover" >
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Titel</th>
|
||||
|
|
@ -115,7 +114,7 @@
|
|||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -124,6 +123,21 @@
|
|||
</div>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
/*
|
||||
var table = $('#activenews').DataTable({
|
||||
searching: true,
|
||||
"language": {
|
||||
"url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/German.json"
|
||||
},
|
||||
buttons: {
|
||||
buttons: [
|
||||
{ extend: 'next', className: 'paginate_button_custom' },
|
||||
{ extend: 'previous', className: 'paginate_button_custom' }
|
||||
]
|
||||
}
|
||||
|
||||
});*/
|
||||
|
||||
$('#news_tabs li:first-child a').tab('show');
|
||||
|
||||
$("#tableSearch").on("keyup", function() {
|
||||
|
|
@ -139,11 +153,13 @@ $(document).ready(function(){
|
|||
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$('#news_tabs a').on('click', function (e) {
|
||||
e.preventDefault()
|
||||
$(this).tab('show')
|
||||
});
|
||||
|
||||
</script>
|
||||
{% endblock content %}
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -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})
|
||||
|
|
|
|||
|
|
@ -59,7 +59,13 @@ body{
|
|||
width: 200px;
|
||||
height: 200px;
|
||||
}
|
||||
|
||||
/*
|
||||
PAGINATION
|
||||
*/
|
||||
.paginate_button_custom {
|
||||
padding: 0px !important;
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
/*
|
||||
FOR TREE ORGA
|
||||
|
|
|
|||
|
|
@ -20,11 +20,7 @@
|
|||
|
||||
<link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
|
||||
|
||||
<!-- Custom styles for this template-->
|
||||
<link href="{% static 'users/css/sb-admin-2.css' %}" rel="stylesheet">
|
||||
|
||||
<link href="{% static 'users/css/theme.css' %}" rel="stylesheet">
|
||||
<link href="{% static 'users/css/custom.css' %}" rel="stylesheet">
|
||||
<!--<link href="{%static 'users/css/bootstrap.min.css' %}" rel="stylesheet">-->
|
||||
<link href='https://fonts.googleapis.com/css?family=Roboto&display=swap' rel='stylesheet' type='text/css'>
|
||||
|
||||
|
|
@ -38,7 +34,15 @@
|
|||
<!-- TABLE SORT -->
|
||||
<!--<link rel="stylesheet" href="https://cdn.datatables.net/1.10.20/css/jquery.dataTables.min.css">-->
|
||||
|
||||
|
||||
<!-- DATATABLES -->
|
||||
<link href="https://cdn.datatables.net/1.10.20/css/jquery.dataTables.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.datatables.net/1.10.20/css/dataTables.bootstrap4.min.css" rel="stylesheet">
|
||||
|
||||
<!-- Custom styles for this template-->
|
||||
<link href="{% static 'users/css/sb-admin-2.css' %}" rel="stylesheet">
|
||||
|
||||
<link href="{% static 'users/css/theme.css' %}" rel="stylesheet">
|
||||
<link href="{% static 'users/css/custom.css' %}" rel="stylesheet">
|
||||
|
||||
|
||||
</head>
|
||||
|
|
@ -120,6 +124,21 @@
|
|||
</a>
|
||||
</li>
|
||||
|
||||
<!--
|
||||
{% if active_link == 'cloud' %}
|
||||
<li class="nav-item active">
|
||||
{% else%}
|
||||
<li class="nav-item">
|
||||
{%endif%}
|
||||
<a class="nav-link " href="{% url 'cloud-main' %}" aria-expanded="true">
|
||||
<i class="fas fa-cloud"></i>
|
||||
<span>Dateien</span>
|
||||
</a>
|
||||
</li>
|
||||
-->
|
||||
|
||||
|
||||
|
||||
{% if perms.users.users_usermanagement or perms.users.areas_management or perms.users.tasks_management or perms.user.news_management %}
|
||||
<hr class="sidebar-divider">
|
||||
<!-- Heading -->
|
||||
|
|
@ -328,6 +347,14 @@
|
|||
|
||||
<!-- Core plugin JavaScript-->
|
||||
<script src="{%static 'users/vendor/jquery-easing/jquery.easing.min.js' %}"></script>
|
||||
<!-- DATABLES JS -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script src="https://cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/1.10.20/js/dataTables.bootstrap4.min.js"></script>
|
||||
|
||||
<!-- Custom scripts for all pages-->
|
||||
<script src="{%static 'users/js/sb-admin-2.min.js' %}"></script>
|
||||
|
|
|
|||
Loading…
Reference in New Issue