Erster Zwischecommit für 0.8.2

This commit is contained in:
holger.trampe 2020-03-23 01:44:57 +01:00
parent 8e8c7ac4aa
commit d64a396f1f
58 changed files with 260 additions and 65 deletions

View File

@ -4,7 +4,6 @@ from .models import Data, DataFile
class CloudAddFileForm(forms.ModelForm): class CloudAddFileForm(forms.ModelForm):
class Meta: class Meta:
model = Data model = Data
labels = { labels = {

View File

@ -27,7 +27,14 @@ a.disabled {
<h3>Dateien&nbsp;<small><i data-toggle="tooltip" data-placement="top" title="Hier können Sie Dateien und Ordner für ihre Agentur verwalten." class="far fa-question-circle"></i></small></h3> <h3>Dateien&nbsp;<small><i data-toggle="tooltip" data-placement="top" title="Hier können Sie Dateien und Ordner für ihre Agentur verwalten." class="far fa-question-circle"></i></small></h3>
<hr> <hr>
</div> </div>
<div class="content-section col-12"> <div class="content-section col-12">
<div class="progress mb-2" style="height: 15px;">
<div class="progress-bar" role="progressbar" aria-valuenow="{{percent_quota}}" style="width: {{percent_quota}}%;" aria-valuemin="0" aria-valuemax="100"><b style="color: #000000; padding-left: 5px">Aktuelle Quota: {{actquota}} / 2 GB</b></div>
</div>
<nav aria-label="breadcrumb"> <nav aria-label="breadcrumb">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item" aria-current="page"><a href="{% url 'cloud-main' 'first' %}"><i class="fas fa-home"></i></a></li> <li class="breadcrumb-item" aria-current="page"><a href="{% url 'cloud-main' 'first' %}"><i class="fas fa-home"></i></a></li>
@ -67,15 +74,16 @@ a.disabled {
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% if d.visibleby.all|length == 0 %} {% if d.visibleby.all|length == 0 %}
{% setbool True %} {% setbool True %}
{% endif %} {% endif %}
{% getbool as groupchecker %} {% getbool as groupchecker %}
{% if groupchecker %}
<tr id="dir_{{d.pk}}" class="droppable_tr"> <tr id="dir_{{d.pk}}" class="droppable_tr">
{% else %}
<tr id="dir_{{d.pk}}" class="droppable_tr" data-toggle="popover" data-placement="top" data-trigger="hover" title="Zugriffsbeschränkung" data-content="Zugriff beschränkt auf {% for dgroup in d.visibleby.all %}{{dgroup.agencygroupname}}{% if forloop.counter < d.visibleby.all|length %}, {%endif%}{% endfor %}">
{% endif %}
<td id="dir_{{d.pk}}_icon"><i class="fas fa-folder" ></i> <td id="dir_{{d.pk}}_icon"><i class="fas fa-folder" ></i>
</td> </td>
<td > <td >
@ -83,6 +91,7 @@ a.disabled {
<a href="{% url 'cloud-main' d.pk %}">{{d.name}}</a> <a href="{% url 'cloud-main' d.pk %}">{{d.name}}</a>
{% else %} {% else %}
<span class="text-secondary"><i class="fas fa-lock"></i>&nbsp;{{d.name}}</span> <span class="text-secondary"><i class="fas fa-lock"></i>&nbsp;{{d.name}}</span>
</span>
{% endif %} {% endif %}
</td> </td>
<td>{{d.owner.first_name}} {{d.owner.last_name}}</td> <td>{{d.owner.first_name}} {{d.owner.last_name}}</td>
@ -331,13 +340,14 @@ a.disabled {
<script> <script>
$(document).ready(function(){ $(document).ready(function(){
$('[data-toggle="popover"]').popover();
$(".toast").toast({ $(".toast").toast({
autohide: true, autohide: true,
delay : 5000 delay : 5000
}); });
}); });
//GROUPS //GROUPS
function showGroupChangeModal(tochangeid){ function showGroupChangeModal(tochangeid){
$("#changeGroupOfDataObj").modal("toggle"); $("#changeGroupOfDataObj").modal("toggle");

View File

@ -15,6 +15,7 @@ import os
from .models import DataDir, DataFile from .models import DataDir, DataFile
from datetime import datetime from datetime import datetime
from users.models import AgencyGroup from users.models import AgencyGroup
from django.conf import settings
''' '''
@ -55,6 +56,17 @@ def checkUserDirRights(request, startdir, userid):
canview = False canview = False
return canview return canview
def folder_size(path='.'):
total = 0
for entry in os.scandir(path):
if entry.is_file():
total += entry.stat().st_size
elif entry.is_dir():
total += folder_size(entry.path)
total_gb = round(total/1024.0**3, 4)
return total_gb
@login_required @login_required
def CloudMain(request, pk): def CloudMain(request, pk):
diragency = [] diragency = []
@ -74,7 +86,9 @@ def CloudMain(request, pk):
'parentid' : diragency.pk, 'parentid' : diragency.pk,
'files' : DataFile.objects.filter(parent=diragency, agency=request.user.profile.agency).order_by("name"), 'files' : DataFile.objects.filter(parent=diragency, agency=request.user.profile.agency).order_by("name"),
'agencygroups' : AgencyGroup.objects.filter(agency=request.user.profile.agency).order_by("agencygroupname"), 'agencygroups' : AgencyGroup.objects.filter(agency=request.user.profile.agency).order_by("agencygroupname"),
"rootid" : rootid "rootid" : rootid,
"actquota" : folder_size(BASE_DIR + "/media/agencydata/agency_"+str(request.user.profile.agency.pk)+"/files"),
"percent_quota" : int(folder_size(BASE_DIR + "/media/agencydata/agency_"+str(request.user.profile.agency.pk)+"/files")/(2/100))
} }
else: else:
@ -98,7 +112,9 @@ def CloudMain(request, pk):
'breadcrump' : breadcrump, 'breadcrump' : breadcrump,
'files' : DataFile.objects.filter(parent=vieweddir, agency=request.user.profile.agency).order_by("name"), 'files' : DataFile.objects.filter(parent=vieweddir, agency=request.user.profile.agency).order_by("name"),
'agencygroups' : AgencyGroup.objects.filter(agency=request.user.profile.agency).order_by("agencygroupname"), 'agencygroups' : AgencyGroup.objects.filter(agency=request.user.profile.agency).order_by("agencygroupname"),
"rootid" : rootid "rootid" : rootid,
"actquota" : folder_size(BASE_DIR + "/media/agencydata/agency_"+str(request.user.profile.agency.pk)+"/files"),
"percent_quota" : int(folder_size(BASE_DIR + "/media/agencydata/agency_"+str(request.user.profile.agency.pk)+"/files")/(2/100))
} }
else: else:
context = { context = {

View File

@ -22,9 +22,10 @@ class UsersNotificationForm(forms.ModelForm):
"user_standard_public_mail" : "Veröffentlichung meiner Standards", "user_standard_public_mail" : "Veröffentlichung meiner Standards",
"agency_new_standard_mail" : "Neue Agentur-Standards", "agency_new_standard_mail" : "Neue Agentur-Standards",
'add_new_group_mail' : "Gruppenmitgliedschaften", 'add_new_group_mail' : "Gruppenmitgliedschaften",
'add_task_mail' : "Tätigkeitsbereich" 'add_task_mail' : "Tätigkeitsbereich",
'user_messages_mail' : "Mitteilungen"
} }
fields = ['news_mail', 'news_push', 'user_standard_public_mail', 'user_standard_public_push', 'agency_new_standard_mail', 'agency_new_standard_push', 'add_new_group_mail', 'add_new_group_push', 'add_task_mail', 'add_task_push'] fields = ['news_mail', 'news_push', 'user_standard_public_mail', 'user_standard_public_push', 'agency_new_standard_mail', 'agency_new_standard_push', 'add_new_group_mail', 'add_new_group_push', 'add_task_mail', 'add_task_push', 'user_messages_mail', 'user_messages_push']
# PERMISSION GROUPS FORM # PERMISSION GROUPS FORM
class AgencyGroupPerms(forms.Form): class AgencyGroupPerms(forms.Form):
@ -54,8 +55,9 @@ class AgencyModulsForm(forms.ModelForm):
'module_quicklinks' : "Quicklinks", 'module_quicklinks' : "Quicklinks",
'module_files' : "Dateien", 'module_files' : "Dateien",
'module_organigramm' : "Organigramm", 'module_organigramm' : "Organigramm",
'module_messages' : "Mitteilungen",
} }
fields = ['module_news','module_quicklinks','module_files','module_organigramm'] fields = ['module_news','module_quicklinks','module_files','module_organigramm', 'module_messages']
# NEW USER FORM # NEW USER FORM
class UserNewUserForm(forms.ModelForm): class UserNewUserForm(forms.ModelForm):

View File

@ -80,8 +80,8 @@ $(document).ready(function(){
/* CROPPER */ /* CROPPER */
$("#id_x").val(0); $("#id_x").val(0);
$("#id_y").val(0); $("#id_y").val(0);
$("#id_width").val(1500); $("#id_width").val(0);
$("#id_height").val(750); $("#id_height").val(0);
$("#id_rotation").val(0); $("#id_rotation").val(0);
function clearImgField(){ function clearImgField(){
@ -106,13 +106,10 @@ $(document).ready(function(){
var $image = $("#imagemod"); var $image = $("#imagemod");
$("#modalCrop").on("shown.bs.modal", function () { $("#modalCrop").on("shown.bs.modal", function () {
$image.cropper({ $image.cropper({
viewMode: 3, viewMode: 0,
aspectRatio: 2/1,
strict: false, strict: false,
cropBoxMovable: true, cropBoxMovable: true,
cropBoxResizable: true, cropBoxResizable: true,
minCropBoxWidth: 750,
minCropBoxHeight: 350,
ready: function () { ready: function () {
$image.cropper("setCanvasData", canvasData); $image.cropper("setCanvasData", canvasData);
$image.cropper("setCropBoxData", cropBoxData); $image.cropper("setCropBoxData", cropBoxData);

View File

@ -102,7 +102,7 @@
<div id="newareaname_err" class="alert alert-danger mt-3" style="display: none">Falsche Eingabe! Keine Sonderzeichen!</div> <div id="newareaname_err" class="alert alert-danger mt-3" style="display: none">Falsche Eingabe! Keine Sonderzeichen!</div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">Abrechen</button>&nbsp; <button type="button" class="btn btn-danger" data-dismiss="modal">Abbrechen</button>&nbsp;
<button id="doActionAreaModal" type="button" class="btn btn-success" data-dismiss="modal" onclick="javascript:mainmodalAreaSave()" disabled="true">Speichern</button> <button id="doActionAreaModal" type="button" class="btn btn-success" data-dismiss="modal" onclick="javascript:mainmodalAreaSave()" disabled="true">Speichern</button>
</div> </div>
</div> </div>
@ -152,7 +152,7 @@
<div id="newtaskname_err" class="alert alert-danger mt-3" style="display: none">Falsche Eingabe! Keine Sonderzeichen!</div> <div id="newtaskname_err" class="alert alert-danger mt-3" style="display: none">Falsche Eingabe! Keine Sonderzeichen!</div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">Abrechen</button>&nbsp; <button type="button" class="btn btn-danger" data-dismiss="modal">Abbrechen</button>&nbsp;
<button id="doActionTaskModal" type="button" class="btn btn-success" data-dismiss="modal" onclick="javascript:mainmodalTaskSave()" disabled="true">Speichern</button> <button id="doActionTaskModal" type="button" class="btn btn-success" data-dismiss="modal" onclick="javascript:mainmodalTaskSave()" disabled="true">Speichern</button>
</div> </div>
</div> </div>

View File

@ -1,5 +1,5 @@
{% load counter_tag %} {% load counter_tag %}
<a href="{% url 'newuserfirst' %}"class="btn btn-primary active" data-toggle="tooltip" data-placement="top" title="Fügen Sie hier einen weiteren Mitarbeiter Ihrer Agentur hinzu.">+ Mitarbeiter</a> <a href="{% url 'newuserfirst' %}"class="btn btn-primary active" data-toggle="tooltip" data-placement="top" title="Fügen Sie hier einen weiteren Mitarbeiter Ihrer Agentur hinzu."><i class="fas fa-plus"></i>&nbsp;Mitarbeiter</a>
<hr> <hr>
<div class="row"> <div class="row">
<div class="form-group mb-2"> <div class="form-group mb-2">
@ -12,6 +12,7 @@
<th scope="col">Name</th> <th scope="col">Name</th>
<th scope="col">E-Mail</th> <th scope="col">E-Mail</th>
<th scope="col">Agenturfunktion</th> <th scope="col">Agenturfunktion</th>
<th scope="col">Letzter Login</th>
<th scope="col">Tätigkeit</th> <th scope="col">Tätigkeit</th>
<th scope="col">Telefon</th> <th scope="col">Telefon</th>
<th scope="col">Mobil</th> <th scope="col">Mobil</th>
@ -24,6 +25,7 @@
<td><a href="{% url 'user_updateprofile' item.pk 0 %}">{{item.first_name }} {{ item.last_name }}</a></td> <td><a href="{% url 'user_updateprofile' item.pk 0 %}">{{item.first_name }} {{ item.last_name }}</a></td>
<td>{{ item.email }}</td> <td>{{ item.email }}</td>
<td>{% if item.profile.func == None %}-{%else%}{{ item.profile.func }}{%endif%}</td> <td>{% if item.profile.func == None %}-{%else%}{{ item.profile.func }}{%endif%}</td>
<td>{% if item.last_login != Nonte %}{{ item.last_login }}{% endif %}</td>
<td>{{ item.profile.compfunc }}</td> <td>{{ item.profile.compfunc }}</td>
<td>{{ item.profile.phoneland }}</td> <td>{{ item.profile.phoneland }}</td>
<td>{{ item.profile.phonemobile }}</td> <td>{{ item.profile.phonemobile }}</td>

View File

@ -61,8 +61,9 @@
{{ mail }} {{ mail }}
</p> </p>
<div style="float: left"> <div style="float: left">
<a type="button" class="btn-primary btn-sm active" href="{% url 'changeusermaindata' vieweduser %}">Stammdaten ändern</a> <a href="{% url 'changeusermaindata' vieweduser %}">
<button type="button" id="" onclick="javascript:sendPassMail({{vieweduser}})" class="btn-primary btn-sm active mt-2">E-Mail mit Link zur Passworterstellung senden</button>&nbsp;&nbsp;<span class="alert alert-success" id="mailsend" role="alert" style="display: none;">&nbsp;E-Mail gesendet!</span> <button type="button" class="btn-primary btn-sm active" >Stammdaten ändern</button></a>
<button type="button" id="" onclick="javascript:sendPassMail({{vieweduser}})" class="btn-primary btn-sm active" >E-Mail mit Link zur Passworterstellung senden</button>&nbsp;&nbsp;<span class="alert alert-success" id="mailsend" role="alert" style="display: none;">&nbsp;E-Mail gesendet!</span>
</div> </div>
</div> </div>
</div> </div>
@ -297,8 +298,8 @@ function addUserToGroup(userid, groupid){
strict: false, strict: false,
cropBoxMovable: true, cropBoxMovable: true,
cropBoxResizable: true, cropBoxResizable: true,
minCropBoxWidth: 200, minCropBoxWidth: 300,
minCropBoxHeight: 200, minCropBoxHeight: 300,
ready: function () { ready: function () {
$image.cropper("setCanvasData", canvasData); $image.cropper("setCanvasData", canvasData);
$image.cropper("setCropBoxData", cropBoxData); $image.cropper("setCropBoxData", cropBoxData);

View File

@ -38,6 +38,7 @@ INSTALLED_APPS = [
'dasettings.apps.DASettingsConfig', 'dasettings.apps.DASettingsConfig',
'areas.apps.AreasConfig', 'areas.apps.AreasConfig',
'orga.apps.OrgaConfig', 'orga.apps.OrgaConfig',
'message.apps.MessageConfig',
'cloud.apps.CloudConfig', 'cloud.apps.CloudConfig',
'tasks.apps.TasksConfig', 'tasks.apps.TasksConfig',
'quicklinks.apps.QuicklinksConfig', 'quicklinks.apps.QuicklinksConfig',
@ -170,12 +171,21 @@ GRAPPELLI_CLEAN_INPUT_TYPES = False
# EMAILs # EMAILs
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
'''
EMAIL_HOST = 'smtp.strato.de' EMAIL_HOST = 'smtp.strato.de'
EMAIL_PORT = 587 EMAIL_PORT = 587
EMAIL_USE_TLS = True EMAIL_USE_TLS = True
EMAIL_HOST_USER = "support@digitale-agentur.com" EMAIL_HOST_USER = "support@digitale-agentur.com"
EMAIL_HOST_PASSWORD = "aPx9m3!7x3m@8o!t" EMAIL_HOST_PASSWORD = "aPx9m3!7x3m@8o!t"
DEFAULT_FROM_EMAIL = "support@digitale-agentur.com" DEFAULT_FROM_EMAIL = "support@digitale-agentur.com"
'''
EMAIL_HOST = 'gymhum.de'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = "holger.trampe"
EMAIL_HOST_PASSWORD = "Motte2016_!"
DEFAULT_FROM_EMAIL = "holger.trampe@gymhum.de"
# FOR DATEPICKER # FOR DATEPICKER
BOOTSTRAP4 = { BOOTSTRAP4 = {

View File

@ -26,6 +26,7 @@ urlpatterns = [
path('', include('users.urls'), name="dashboard-first"), path('', include('users.urls'), name="dashboard-first"),
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
path('dasettings/', include('dasettings.urls'), name="dasettings"), path('dasettings/', include('dasettings.urls'), name="dasettings"),
path('messages/', include('message.urls'), name="messages"),
path('dashboard/', include('users.urls'), name="dashboard"), path('dashboard/', include('users.urls'), name="dashboard"),
path('areas/', include('areas.urls'), name="areas-management"), path('areas/', include('areas.urls'), name="areas-management"),
path('tasks/', include('tasks.urls'), name="tasks-management"), path('tasks/', include('tasks.urls'), name="tasks-management"),

View File

@ -1,3 +1,4 @@
from django.shortcuts import render from django.shortcuts import render
def registerdone(request): def registerdone(request):
return render (request, 'users/registercomplete.html') return render (request, 'users/registercomplete.html')

BIN
media/ag_default.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

0
message/__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.

3
message/admin.py Normal file
View File

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

5
message/apps.py Normal file
View File

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

8
message/forms.py Normal file
View File

@ -0,0 +1,8 @@
from django import forms
from users.models import UserFullName
class MessageForm(forms.Form):
def __init__(self, user, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields['target_user'] = forms.ChoiceField(label="Mitarbeiter", choices=[(u.id, u) for u in UserFullName.objects.filter(profile__agency__pk=user.profile.agency.pk).exclude(pk=user.pk)])
self.fields['message_content'] = forms.CharField(required=True, widget=forms.Textarea, label="Mitteilung")

View File

Binary file not shown.

3
message/models.py Normal file
View File

@ -0,0 +1,3 @@
from django.db import models
# Create your models here.

View File

@ -0,0 +1,23 @@
{% extends "users/base.html" %}
{% load crispy_forms_tags %}
{% block content %}
{% if request.user.profile.agency.module_messages %}
<div class="content-section col-6">
<h3>Mitteilungen&nbsp;<small><i data-toggle="tooltip" data-placement="top" title="Verschicken Sie hier Nachrichten für Mitarbeiter." class="far fa-question-circle"></i></small></h3>
<hr>
<form method="POST" enctype="multipart/form-data">
{% csrf_token %}
{{form|crispy}}
<p>Ihrer Mitteilung wird Automatisch eine Anrede und eine Verabscheidung hinzugefügt!</p>
<div class="form-group">
<button type="submit" class="btn btn-success">Mitteilung verschicken</button>&nbsp;
<a href="{% url 'users-dashboard' %}" class="btn btn-success">Abbrechen</a>
</div>
</form>
</div>
{% else %}
<h3>Das Modul Mitteilungen wurde in ihrer Agentur deaktiviert.</h3>
{% endif %}
{% endblock content %}

View File

@ -0,0 +1,15 @@
{% extends "users/base.html" %}
{% load crispy_forms_tags %}
{% block content %}
{% if request.user.profile.agency.module_messages %}
<div class="content-section col-6">
<h3>Mitteilungen&nbsp;<small><i data-toggle="tooltip" data-placement="top" title="Verschicken Sie hier Nachrichten für Mitarbeiter." class="far fa-question-circle"></i></small></h3>
<hr>
Ihre Mitteilung wurde gesendet.
</div>
{% else %}
<h3>Das Modul Mitteilungen wurde in ihrer Agentur deaktiviert.</h3>
{% endif %}
{% endblock content %}

3
message/tests.py Normal file
View File

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

9
message/urls.py Normal file
View File

@ -0,0 +1,9 @@
from django.contrib import admin
from django.urls import path, include
from django.contrib.auth import views as auth_views
from . import views
from django.contrib.auth.decorators import login_required
urlpatterns = [
path('', views.mainmessageview, name="messages"),
]

53
message/views.py Normal file
View File

@ -0,0 +1,53 @@
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 .forms import MessageForm
from notificsys.models import UserNotification
from django.core.mail import send_mail
from django.template.loader import render_to_string
# ALLE STANDARDS EINER AGENTUR
@login_required
def mainmessageview(request):
if request.method == 'POST':
context = {
'active_link' : 'messages'
}
targetuser_id = request.POST["target_user"]
message = request.POST["message_content"]
targetuser = User.objects.get(pk=targetuser_id)
notificationtext = message + " Grüße, " + request.user.first_name + " " + request.user.last_name
if(targetuser.profile.user_messages_mail):
username = targetuser.first_name + " " + targetuser.last_name
msg_html = render_to_string('notificsys/notification_mail.html', {'username': username, 'notificationtext' : notificationtext})
send_mail(
'Agentur-Benachrichtigung',
'Hallo ' + targetuser.first_name + ' ' + targetuser.last_name + '! ' + notificationtext,
'support@digitale-agentur.com',
[targetuser.email],
html_message=msg_html,
fail_silently=False
)
if(targetuser.profile.user_messages_push):
newnotification = UserNotification(touser=targetuser, notificationtext='Hallo ' + targetuser.first_name + ' ' + targetuser.last_name + '! ' + notificationtext, notificationtype="messagereceived")
newnotification.save()
return render (request, 'message/message_send.html', context)
else:
context = {
'active_link' : 'messages',
'form' : MessageForm(request.user)
}
# Adding active_link
# Loading only user same agency
# Change context and return for template-data
# # Get all Users of the Same Agency as logged user
return render (request, 'message/message.html', context)

View File

@ -4,28 +4,35 @@
<div class="content-section col-12"> <div class="content-section col-12">
<h3>News&nbsp;<small><i data-toggle="tooltip" data-placement="top" title="Hier können aktuelle Nachrichten für die Agentur erstellt und verwaltet werden." class="far fa-question-circle"></i></small></h3> <h3>News&nbsp;<small><i data-toggle="tooltip" data-placement="top" title="Hier können aktuelle Nachrichten für die Agentur erstellt und verwaltet werden." class="far fa-question-circle"></i></small></h3>
<hr> <hr>
{% if perms.users.modulenews %}
<div class="row"> <div class="row">
<div class="content-section col-4"> <div class="content-section col-4">
<a class="btn btn-primary" href="{% url 'news-add' %} " data-toggle="tooltip" data-placement="top" title="Neue News für Ihre Agentur erstellen"><i class="fas fa-plus"></i>&nbsp;News</a> <a class="btn btn-primary" href="{% url 'news-add' %} " data-toggle="tooltip" data-placement="top" title="Neue News für Ihre Agentur erstellen"><i class="fas fa-plus"></i>&nbsp;News</a>
</div> </div>
</div> </div>
<hr> <hr>
{% endif %}
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<ul class="nav nav-tabs" id="news_tabs" role="tablist"> <ul class="nav nav-tabs" id="news_tabs" role="tablist">
{% if perms.users.modulenews %}
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" id="act" data-toggle="tab" href="#t_act" role="tab" aria-controls="news" aria-selected="false">Aktuelle</a> <a class="nav-link" id="act" data-toggle="tab" href="#t_act" role="tab" aria-controls="news" aria-selected="false">Aktuelle</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" id="coming" data-toggle="tab" href="#t_coming" role="tab" aria-controls="coming" aria-selected="false">Ausstehende</a> <a class="nav-link" id="coming" data-toggle="tab" href="#t_coming" role="tab" aria-controls="coming" aria-selected="false">Ausstehende</a>
</li> </li>
{% endif %}
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" id="archiv" data-toggle="tab" href="#t_archiv" role="tab" aria-controls="archiv" aria-selected="false">Archiv</a> <a class="nav-link" id="archiv" data-toggle="tab" href="#t_archiv" role="tab" aria-controls="archiv" aria-selected="false">Archiv</a>
</li> </li>
</ul> </ul>
</div> </div>
<div class="col"> <div class="col">
<div class="tab-content" id="tab_contents"> <div class="tab-content" id="tab_contents">
{% if perms.users.modulenews %}
<div class="tab-pane fade" id="t_act" role="tabpanel" aria-labelledby="act"> <div class="tab-pane fade" id="t_act" role="tabpanel" aria-labelledby="act">
<h5 class="mt-3"><a href="" style="color: #000000;">Aktuelle News</a></h5> <h5 class="mt-3"><a href="" style="color: #000000;">Aktuelle News</a></h5>
<hr> <hr>
@ -73,8 +80,8 @@
</div> </div>
</div> </div>
</div> </div>
{% endif %}
{% if perms.users.modulenews %}
<div class="tab-pane fade" id="t_coming" role="tabpanel" aria-labelledby="coming"> <div class="tab-pane fade" id="t_coming" role="tabpanel" aria-labelledby="coming">
<h5 class="mt-3"><a href="" style="color: #000000;">Ausstehende News</a></h5> <h5 class="mt-3"><a href="" style="color: #000000;">Ausstehende News</a></h5>
<hr> <hr>
@ -119,7 +126,7 @@
</div> </div>
</div> </div>
</div> </div>
{% endif %}

View File

@ -125,7 +125,6 @@
<div style="font-family:Roboto;font-size:18px;line-height:1;text-align:left;color:#000000;"> <div style="font-family:Roboto;font-size:18px;line-height:1;text-align:left;color:#000000;">
<p>Hallo {{username}},</p> <p>Hallo {{username}},</p>
<p>{{notificationtext}}</p> <p>{{notificationtext}}</p>
<p>Weitere Informationen erhalten Sie von Ihrem Agenturleiter. Vielen Dank, dass Sie die Plattform <b>Digitale Agentur</b> nutzen!</p>
<p>Mit freundlichen Grüßen</p> <p>Mit freundlichen Grüßen</p>
<p>Ihr Team von Digitale Agentur</p> <p>Ihr Team von Digitale Agentur</p>
</div> </div>

View File

@ -103,6 +103,6 @@ def delSingleNotification(request):
def delAllNotification(request): def delAllNotification(request):
if request.method == 'GET': if request.method == 'GET':
if request.GET['action'] == 'delall': if request.GET['action'] == 'delall':
todelnotification = UserNotification.objects.filter(touser__pk=request.user.pk).delete() UserNotification.objects.filter(touser__pk=request.user.pk).delete()
return JsonResponse({}) return JsonResponse({})

View File

@ -26,13 +26,9 @@ var data = [
{ 'id' : '{{request.user.profile.agency.pk}}', 'parent' : "", 'role': "", 'name': '{{request.user.profile.agency.name}}', 'color': '#71AF17', "imageUrl": "", 'children' : []}, { 'id' : '{{request.user.profile.agency.pk}}', 'parent' : "", 'role': "", 'name': '{{request.user.profile.agency.name}}', 'color': '#71AF17', "imageUrl": "", 'children' : []},
{% for u in agencyuser %} {% for u in agencyuser %}
{% if u.profile.parent == u %} {% if u.profile.parent == u %}
{ 'id': '{{u.pk}}' , 'name': "{{u.first_name}} {{u.last_name}}",'role': '<b>{% if u.profile.func != None %} {{u.profile.func}} {% endif %}</b></br >{{u.profile.compfunc}}', 'parent': "{{request.user.profile.agency.pk}}", 'color': '#1859B7', "imageUrl": "{{u.profile.get_photo_url}}", 'userid' : '{{u.pk}}', 'children' : [] },
{ 'id': '{{u.pk}}' , 'name': "{{u.first_name}} {{u.last_name}}",'role': '<b>{% if u.profile.func == None %} n.a. {% else %} {{u.profile.func}} {% endif %}</b></br >{{u.profile.compfunc}}', 'parent': "{{request.user.profile.agency.pk}}", 'color': '#1859B7', "imageUrl": "{{u.profile.get_photo_url}}", 'userid' : '{{u.pk}}', 'children' : [] },
{% else %} {% else %}
{ 'id': '{{u.pk}}', 'name': "{{u.first_name}} {{u.last_name}}", 'role': '<b>{% if u.profile.func == None %} n.a. {% else %} {{u.profile.func}} {% endif %}</b></br >{{u.profile.compfunc}}', 'parent': '{{u.profile.parent.pk}}', 'color': '#1859B7', "imageUrl": "{{u.profile.get_photo_url }}", 'userid' : '{{u.pk}}', 'children' : []}, { 'id': '{{u.pk}}', 'name': "{{u.first_name}} {{u.last_name}}", 'role': '<b>{% if u.profile.func != None %} {{u.profile.func}} {% endif %}</b></br >{{u.profile.compfunc}}', 'parent': '{{u.profile.parent.pk}}', 'color': '#1859B7', "imageUrl": "{{u.profile.get_photo_url }}", 'userid' : '{{u.pk}}', 'children' : []},
{% endif %} {% endif %}
{% endfor %} {% endfor %}
]; ];

View File

@ -3,7 +3,7 @@
{% block content %} {% block content %}
<div class="content-section col-12"> <div class="content-section col-12">
<h3>Standards&nbsp;<small><i data-toggle="tooltip" data-placement="top" title="Standards dokumentieren und erläutern verschiedenen Verfahren, strukturiert nach Bereichen und Aufgaben." class="far fa-question-circle"></i></small></h3> <h3>Standards&nbsp;<small><i data-toggle="tooltip" data-placement="top" title="Standards dokumentieren und erläutern verschiedenen Verfahren, strukturiert nach Bereichen und Tätigkeiten." class="far fa-question-circle"></i></small></h3>
<small>Sichtbar sind alle veröffentlichten und von {{ user.first_name }} {{ user.last_name}} erstellten Standards.</small> <small>Sichtbar sind alle veröffentlichten und von {{ user.first_name }} {{ user.last_name}} erstellten Standards.</small>
<hr> <hr>
<div class="row"> <div class="row">
@ -64,7 +64,7 @@
{% if groupchecker %} {% if groupchecker %}
<p class="card-text"><a href="{% url 'standard-single' s.pk %}">{{s.name|truncatechars:28}}</a></p> <p class="card-text"><a href="{% url 'standard-single' s.pk %}">{{s.name|truncatechars:28}}</a></p>
{% else %} {% else %}
<p class="card-text text-secondary"><i class="fas fa-lock"></i>&nbsp;{{s.name|truncatechars:28}}</p> <p class="card-text text-secondary" data-toggle="popover" data-placement="top" data-trigger="hover" title="Zugriffsbeschränkung" data-content="Zugriff beschränkt auf {% for sgroup in s.visibleby.all %}{{sgroup.agencygroupname}}{% if forloop.counter < s.visibleby.all|length %},{%endif%}{% endfor %}"><i class="fas fa-lock"></i>&nbsp;{{s.name|truncatechars:28}}</p>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
@ -73,6 +73,7 @@
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</div> </div>
{% endfor %} {% endfor %}
<div class="tab-pane fade" id="t_userown" role="tabpanel" aria-labelledby="userown"> <div class="tab-pane fade" id="t_userown" role="tabpanel" aria-labelledby="userown">
@ -187,6 +188,7 @@
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function(){ $(document).ready(function(){
$('[data-toggle="popover"]').popover();
$('#area_tabs li:first-child a').tab('show'); $('#area_tabs li:first-child a').tab('show');
$("#tableSearch").on("keyup", function() { $("#tableSearch").on("keyup", function() {

View File

@ -37,7 +37,7 @@ class StandardsManagement(LoginRequiredMixin, ListView):
tasks_in_area = Tasks.objects.filter(agency__pk=self.request.user.profile.agency.pk, area__pk=a.pk).order_by("name") tasks_in_area = Tasks.objects.filter(agency__pk=self.request.user.profile.agency.pk, area__pk=a.pk).order_by("name")
for t in tasks_in_area: for t in tasks_in_area:
standardcontent[len(standardcontent)-1]['tasks'].append({"task" : t, "standards" : Standards.objects.filter(agency__pk=self.request.user.profile.agency.pk, area__pk=a.pk, task = t.pk, area = a.pk, public=True).order_by("created_standard_date")}) standardcontent[len(standardcontent)-1]['tasks'].append({"task" : t, "standards" : Standards.objects.filter(agency__pk=self.request.user.profile.agency.pk, area__pk=a.pk, task = t.pk, area = a.pk, public=True).order_by("-created_standard_date")})
#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, 'standardcontent' : standardcontent}) #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, 'standardcontent' : standardcontent})

View File

@ -41,7 +41,7 @@ class Agency(models.Model):
plz = models.CharField(default="", max_length=5, blank=True) plz = models.CharField(default="", max_length=5, blank=True)
agency_email = models.EmailField(default="", blank=True) agency_email = models.EmailField(default="", blank=True)
phone = models.CharField(default="", max_length=50, blank=True) phone = models.CharField(default="", max_length=50, blank=True)
agencypic = models.ImageField(default='agencymain/default.jpg', upload_to=picturepath_agency, blank=True) agencypic = models.ImageField(default='ag_default.jpg', upload_to=picturepath_agency, blank=True)
# MONEY # MONEY
balance = models.FloatField(default=0.0, max_length=9, blank=True) balance = models.FloatField(default=0.0, max_length=9, blank=True)
@ -52,6 +52,10 @@ class Agency(models.Model):
module_quicklinks = models.BooleanField(default=True) module_quicklinks = models.BooleanField(default=True)
module_files = models.BooleanField(default=True) module_files = models.BooleanField(default=True)
module_organigramm = models.BooleanField(default=True) module_organigramm = models.BooleanField(default=True)
module_messages = models.BooleanField(default=True)
def __str__(self): def __str__(self):
return f'{self.name}' return f'{self.name}'
@ -65,7 +69,7 @@ class Agency(models.Model):
if self.agencypic and hasattr(self.agencypic, 'url'): if self.agencypic and hasattr(self.agencypic, 'url'):
return self.agencypic.url return self.agencypic.url
else: else:
return "/media/agencymain/default.jpg" return "/media/ag_default.jpg"
''' '''
@ -108,7 +112,7 @@ class Profile(models.Model):
func = models.ForeignKey("AgencyJob", blank=True, null=True, default=None, on_delete=models.SET_NULL) func = models.ForeignKey("AgencyJob", blank=True, null=True, default=None, on_delete=models.SET_NULL)
# Wenn dieses Profil gelöscht wird, wird NICHT die Agency geslöscht # Wenn dieses Profil gelöscht wird, wird NICHT die Agency geslöscht
agency = models.ForeignKey(Agency, on_delete=models.PROTECT) agency = models.ForeignKey(Agency, on_delete=models.PROTECT)
image = models.ImageField(default='userprofilepics/default.jpg', upload_to=picturepath_user, blank=True) image = models.ImageField(default='default.jpg', upload_to=picturepath_user, blank=True)
compfunc = models.CharField(max_length=60, blank=True) compfunc = models.CharField(max_length=60, blank=True)
visible = models.BooleanField(default=True) visible = models.BooleanField(default=True)
persnumber = models.CharField(default="", max_length=50, blank=True) persnumber = models.CharField(default="", max_length=50, blank=True)
@ -142,6 +146,11 @@ class Profile(models.Model):
add_task_mail = models.BooleanField(default=False) add_task_mail = models.BooleanField(default=False)
add_task_push = models.BooleanField(default=True) add_task_push = models.BooleanField(default=True)
# MESSAGES
# Mitteilungen
user_messages_mail = models.BooleanField(default=True)
user_messages_push = models.BooleanField(default=True)
def __str__(self): def __str__(self):
return f'{self.user.last_name}' return f'{self.user.last_name}'
@ -212,7 +221,7 @@ class UserFullName(User):
proxy = True proxy = True
def __unicode__(self): def __unicode__(self):
return "MEIN NAME" return "placeholder"
def __str__(self): def __str__(self):
return f'{self.first_name + " " + self.last_name}' return f'{self.first_name + " " + self.last_name}'

Binary file not shown.

After

Width:  |  Height:  |  Size: 513 B

View File

@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content=""> <meta name="description" content="">
<meta name="author" content=""> <meta name="author" content="">
<link rel="shortcut icon" type="image/x-icon" href="{% static 'users/img/favicon.png' %}">
<title>Digitale Agentur</title> <title>Digitale Agentur</title>
<!-- Custom fonts for this template--> <!-- Custom fonts for this template-->
@ -36,6 +36,12 @@
<link href="https://cdn.jsdelivr.net/npm/summernote@0.8.15/dist/summernote.min.css" rel="stylesheet"> <link href="https://cdn.jsdelivr.net/npm/summernote@0.8.15/dist/summernote.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/summernote@0.8.15/dist/summernote.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/summernote@0.8.15/dist/summernote.min.js"></script>
{% endif %} {% endif %}
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="{% static 'users/js/jsLists.js' %}"></script> <script src="{% static 'users/js/jsLists.js' %}"></script>
<link href="{% static 'users/css/jsLists.css' %}" rel="stylesheet"> <link href="{% static 'users/css/jsLists.css' %}" rel="stylesheet">
@ -150,6 +156,21 @@
</li> </li>
{% endif %} {% endif %}
{% if request.user.profile.agency.module_messages %}
{% if active_link == 'messages' %}
<li class="nav-item active">
{% else%}
<li class="nav-item">
{%endif%}
<a class="nav-link " href="{% url 'messages' %}" aria-expanded="true">
<i class="fas fa-envelope"></i>
<span>Mitteilungen</span>
</a>
</li>
{% endif %}
<!-- <!--
{% if perms.users.users_usermanagement %} {% if perms.users.users_usermanagement %}

View File

@ -14,8 +14,8 @@
<h5 class="card-title">News <h5 class="card-title">News
{% if perms.users.modulenews %} {% if perms.users.modulenews %}
<a class="btn btn-primary btn-sm ml-1" href="{% url 'news-add' %} " style="float: right;" data-toggle="tooltip" data-placement="top" title="Neue News für Ihre Agentur erstellen"><i class="fas fa-plus"></i></a> <a class="btn btn-primary btn-sm ml-1" href="{% url 'news-add' %} " style="float: right;" data-toggle="tooltip" data-placement="top" title="Neue News für Ihre Agentur erstellen"><i class="fas fa-plus"></i></a>
<a class="btn btn-secondary btn-sm" href="{% url 'news-management' %} " style="float: right;" data-toggle="tooltip" data-placement="top" title="Alle News und das News-Archiv betrachten"><i class="fas fa-list"></i></a>
{% endif %} {% endif %}
<a class="btn btn-secondary btn-sm" href="{% url 'news-management' %} " style="float: right;" data-toggle="tooltip" data-placement="top" title="Alle News und das News-Archiv betrachten"><i class="fas fa-list"></i></a>
</h5> </h5>
<div class="table-responsive"> <div class="table-responsive">
<table class="table"> <table class="table">
@ -42,7 +42,7 @@
{% if request.user.profile.agency.module_news %} {% if request.user.profile.agency.module_news %}
<div class="card d-block mb-3" style="width: 34.8%"> <div class="card d-block mb-3" style="width: 34.8%">
<div class="card-body"> <div class="card-body">
<img width="100%" src="{{ request.user.profile.agency.get_photo_url }}"> <img style="max-height: 400px; max-width: 100%" src="{{ request.user.profile.agency.get_photo_url }}">
</div> </div>
</div> </div>
{% endif %} {% endif %}
@ -61,14 +61,14 @@
<tr> <tr>
<th scope="col">Titel</th> <th scope="col">Titel</th>
<th scope="col">Erstellt von</th> <th scope="col">Erstellt von</th>
<th scope="col">Erstellt am</th> <th scope="col">Zuletzt bearbeitet am</th>
</tr> </tr>
</thead> </thead>
{% for standard in standards_of_agency %} {% for standard in standards_of_agency %}
<tr> <tr>
<td><a href="{% url 'standard-single' standard.pk %}">{{standard.name}}</a></td> <td><a href="{% url 'standard-single' standard.pk %}">{{standard.name}}</a></td>
<td>{{standard.created_standard_by.first_name}} {{standard.created_standard_by.last_name}}</td> <td>{{standard.created_standard_by.first_name}} {{standard.created_standard_by.last_name}}</td>
<td>{{standard.created_standard_date|date:"d.m.Y, H:i"}}</td> <td>{{standard.last_modified_on|date:"d.m.Y, H:i"}}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
@ -79,7 +79,7 @@
{% if not request.user.profile.agency.module_news %} {% if not request.user.profile.agency.module_news %}
<div class="card d-block mb-3" style="width: 34.8%"> <div class="card d-block mb-3" style="width: 34.8%">
<div class="card-body"> <div class="card-body">
<img width="100%" src="{{ request.user.profile.agency.get_photo_url }}"> <img style="max-height: 400px; max-width: 100%" src="{{ request.user.profile.agency.get_photo_url }}">
</div> </div>
</div> </div>
{% endif %} {% endif %}

View File

@ -13,7 +13,7 @@
<p>Hallo {{username}},</p> <p>Hallo {{username}},</p>
<p>für Sie wurde ein Account in der Agentur <b>{{user.profile.agency.name}}</b> erstellt. Bitte gehen Sie auf folgenden Link, um ein Passwort zu erstellen:</p> <p>für Sie wurde ein Account in der Agentur <b>{{user.profile.agency.name}}</b> erstellt. Bitte gehen Sie auf folgenden Link, um ein Passwort zu erstellen:</p>
<p><a href="https://digitale-agentur.com/password-reset">https://digitale-agentur.com/password-reset</a></p> <p><a href="https://digitale-agentur.com/password-reset">https://digitale-agentur.com/password-reset</a></p>
<p>Weitere Informationen erhalten Sie von Ihrem Agenturleiter. Vielen Dank, dass Sie die Plattform <b>Digitale Agentur</b> nutzen!</p>
<p>Mit freundlichen Grüßen</p> <p>Mit freundlichen Grüßen</p>
<p>Ihr Team von Digitale Agentur</p> <p>Ihr Team von Digitale Agentur</p>
</mj-text> </mj-text>

View File

@ -16,7 +16,7 @@
<h4>Ihr Benutzername: {{ user.get_username }}</h4> <h4>Ihr Benutzername: {{ user.get_username }}</h4>
</p> </p>
Sollten Sie kein Passwort angefordert haben, ignorieren Sie diese E-Mail. Sollten Sie kein Passwort angefordert haben, ignorieren Sie diese E-Mail.
<p>Weitere Informationen erhalten Sie von Ihrem Agenturleiter. Vielen Dank, dass Sie die Plattform <b>Digitale Agentur</b> nutzen!</p>
<p>Mit freundlichen Grüßen</p> <p>Mit freundlichen Grüßen</p>
<p>Ihr Team von Digitale Agentur</p> <p>Ihr Team von Digitale Agentur</p>
</mj-text> </mj-text>

View File

@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content=""> <meta name="description" content="">
<meta name="author" content=""> <meta name="author" content="">
<link rel="shortcut icon" type="image/x-icon" href="{% static 'users/img/favicon.png' %}">
<title>Digitale Agentur</title> <title>Digitale Agentur</title>
<!-- Custom fonts for this template--> <!-- Custom fonts for this template-->

View File

@ -17,7 +17,7 @@
<br /> <br />
Weitere Informationen erhalten Sie in unserem Wiki <a href="https://wiki.digitale-agentur.com/">https://wiki.digitale-agentur.com/</a> oder per E-Mail an support@digitale-agentur.com! Weitere Informationen erhalten Sie in unserem Wiki <a href="https://wiki.digitale-agentur.com/">https://wiki.digitale-agentur.com/</a> oder per E-Mail an support@digitale-agentur.com!
</p> </p>
<p>Weitere Informationen erhalten Sie von Ihrem Agenturleiter. Vielen Dank, dass Sie die Plattform <b>Digitale Agentur</b> nutzen!</p>
<p>Mit freundlichen Grüßen</p> <p>Mit freundlichen Grüßen</p>
<p>Ihr Team von Digitale Agentur</p> <p>Ihr Team von Digitale Agentur</p>
</mj-text> </mj-text>

View File

@ -3,16 +3,16 @@
{% block content %} {% block content %}
<div class="content-section col-6"> <div class="content-section col-6">
<h3>Supportanfrage stellen</h3> <h3>Supportanfrage stellen</h3>
<small>Haben Sie schon in unserem <a href="https://wiki.digitale-agentur.com/" target="_blank">Wiki</a> nachgesehen? Dort finden Sie viele Tipps und Anregungen!</small>
<hr> <hr>
<form method="POST" enctype="multipart/form-data"> <form method="POST" enctype="multipart/form-data">
{% csrf_token %} {% csrf_token %}
{{form|crispy}} {{form|crispy}}
<div class="form-group"> <div class="form-group">
<button type="submit" class="btn btn-success">Supportanfrage verschicken</button>&nbsp; <button type="submit" class="btn btn-success">Supportanfrage verschicken</button>&nbsp;
<a href="{% url 'users-management' %}" class="btn btn-success">Abbrechen</a> <a href="{% url 'users-dashboard' %}" class="btn btn-success">Abbrechen</a>
</div> </div>
</form> </form>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
</script> </script>

View File

@ -54,7 +54,7 @@ class UsersAddProfileForm(forms.ModelForm):
h = self.cleaned_data.get('height') h = self.cleaned_data.get('height')
image = Image.open(photo.image) image = Image.open(photo.image)
cropped_image = image.crop((x, y, w+x, h+y)) cropped_image = image.crop((x, y, w+x, h+y))
resized_image = cropped_image.resize((560, 560), Image.ANTIALIAS) resized_image = cropped_image.resize((300, 300), Image.ANTIALIAS)
resized_image.save(photo.image.path) resized_image.save(photo.image.path)
return photo return photo
except: except:
@ -93,8 +93,8 @@ class AgencyUpdateForm(forms.ModelForm):
image = Image.open(photo.agencypic) image = Image.open(photo.agencypic)
rotatet_image = image.rotate(rotation, expand=True) rotatet_image = image.rotate(rotation, expand=True)
cropped_image = rotatet_image.crop((x, y, w+x, h+y)) cropped_image = rotatet_image.crop((x, y, w+x, h+y))
resized_image = cropped_image.resize((1500, 750), Image.ANTIALIAS) #resized_image = cropped_image.resize((w, h), Image.ANTIALIAS)
resized_image.save(photo.agencypic.path) cropped_image.save(photo.agencypic.path)
return photo return photo
except: except:
print("no photo") print("no photo")