From 6f2d0adfff7a023399d6f412cf7b3eeb67fd0016 Mon Sep 17 00:00:00 2001 From: "holger.trampe" Date: Thu, 12 Dec 2019 21:13:13 +0100 Subject: [PATCH] =?UTF-8?q?ALLES=20F=C3=9CR=20EINE=20FEUCHTE=20VAGINA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- orga/templates/orga/orga_main.html | 4 ++-- orga/templates/orga/orga_single.html | 4 +--- users/__pycache__/models.cpython-38.pyc | Bin 3177 -> 3578 bytes users/models.py | 17 +++++++++++++++-- users/templates/users/agency.html | 2 +- users/templates/users/dashboard.html | 2 +- users/templates/users/profile.html | 2 +- users/templates/users/profile_update.html | 2 +- 8 files changed, 22 insertions(+), 11 deletions(-) diff --git a/orga/templates/orga/orga_main.html b/orga/templates/orga/orga_main.html index a8c73fe..de731e2 100644 --- a/orga/templates/orga/orga_main.html +++ b/orga/templates/orga/orga_main.html @@ -21,9 +21,9 @@ var data = [ { 'id': 'parent', 'role': "", 'name': 'Agentur {{request.user.profile.agency.name}}', 'color': '#71AF17', "imageUrl": ""}, {% for u in agencyuser %} {% if u.profile.parent == u %} - { 'id': '{{u.pk}}' , 'name': "{{u.first_name}} {{u.last_name}}",'role': '{{u.profile.get_func_display}}\n{{u.profile.compfunc}}', 'manager': 'parent', 'color': '#1859B7', "imageUrl": "{{u.profile.image.url}}", 'userid' : '{{u.pk}}' }, + { 'id': '{{u.pk}}' , 'name': "{{u.first_name}} {{u.last_name}}",'role': '{{u.profile.get_func_display}}\n{{u.profile.compfunc}}', 'manager': 'parent', 'color': '#1859B7', "imageUrl": "{{u.profile.image.get_photo_url}}", 'userid' : '{{u.pk}}' }, {% else %} - { 'id': '{{u.pk}}', 'name': "{{u.first_name}} {{u.last_name}}", 'role': '{{u.profile.get_func_display}}\n{{u.profile.compfunc}}', 'manager': '{{u.profile.parent.pk}}', 'color': '#1859B7', "imageUrl": "{{u.profile.image.url }}", 'userid' : '{{u.pk}}'}, + { 'id': '{{u.pk}}', 'name': "{{u.first_name}} {{u.last_name}}", 'role': '{{u.profile.get_func_display}}\n{{u.profile.compfunc}}', 'manager': '{{u.profile.parent.pk}}', 'color': '#1859B7', "imageUrl": "{{u.profile.image.get_photo_url }}", 'userid' : '{{u.pk}}'}, {% endif %} {% endfor %} ]; diff --git a/orga/templates/orga/orga_single.html b/orga/templates/orga/orga_single.html index 0e00f10..49cd764 100644 --- a/orga/templates/orga/orga_single.html +++ b/orga/templates/orga/orga_single.html @@ -48,8 +48,7 @@ {% endfor %} - - + {% for area in areas %} @@ -70,7 +69,6 @@ border-collapse: separate; border-spacing: 25px 0px; } - {% endblock content %} \ No newline at end of file diff --git a/users/__pycache__/models.cpython-38.pyc b/users/__pycache__/models.cpython-38.pyc index 2e60c8c145578382904f201da70e1639cf83e444..2b5eb4c3fa6198c80b0c99ecceea7846ed7fce28 100644 GIT binary patch delta 1018 zcmbVLK~ED=5Z?FpwOzJ!TPl^ZMKK76~ly38Odw^g} zq{hUA7<`Gr3wMu%@B{Sh$#B}c2d^HDiO#%(K!A(yWxko6%$v;2H~S<1t6)7&rA!UZ z-qz2VKbdWd6EhBwGFl7LSKxdRgP0jz3^ z5E&BGoUBn{qqRtiRXP+j1wHTSS4fvM z*{vsH0HQ??0+t^c4dFLD5iX01=-cmESq1bZ0ni9e0~o|28Ff)-slg1L61l;8$v3&p zUd1e)S!Z%AcB$XX^DdrOv+usA@osLnG;Xiavi(M5TDbsh6y!?mHM#sg{%nnsMeKnWx-X<}c4a5wfzu-nWRRQYD7h-Xnt4)`-_2{K5+=s7%SOdtYRon3mHp)q zI3O{Mpq67&P9#s=SMyVVKY>syG6L3JkN}%E7$xfdW=4i|!ot9+P*@gXF<6&adzuo{ U5F_$q@?8#J9_d5gY%h|bzX}h<;s5{u delta 652 zcmZ`$&x_MQ7|oZY-L%awR%(;Rb+PM0V?79EK|xnp5ljkcF)ikJ8pc+lL}B8#<{xu--nvzSe*!<<`6=we4rk7(Q`anYFP(`?M*-Hf|< zb!i1Zsy*=WtNN*ZjLvySg1>++zSqua*U96Zz5z$^o4$D^YK-rvv*b}eNq8WYCl>O` zMai`Yq(Uqc7+`~2j&fBE9Us&b*-n0MKC3og7FfCzRvahOu@Ff* woyKvcl=D(jrU~h7lcwn5Z!<7muysQ>YUVNz@s#ztEzc_#|7O51)&SQ20QUHMg#Z8m diff --git a/users/models.py b/users/models.py index ff21a82..55167cf 100644 --- a/users/models.py +++ b/users/models.py @@ -31,7 +31,7 @@ class Agency(models.Model): city = models.CharField(default="", max_length=200, blank=True) email = models.EmailField(default="", blank=True) phone = models.CharField(default="", max_length=20, blank=True) - agencypic = models.ImageField(default='default.jpg', upload_to='agencymain', blank=True) + agencypic = models.ImageField(default='default.jpg', upload_to='agencymain', blank=True, null="default.jpg") def __str__(self): return f'{self.name}' @@ -40,6 +40,13 @@ class Agency(models.Model): def get_absolute_url(self): return reverse('agency-update', kwargs={'pk':self.pk}) + @property + def get_photo_url(self): + if self.agencypic and hasattr(self.agencypic, 'url'): + return self.agencypic.url + else: + return "/media/default.jpg" + ''' Class Profile @@ -77,7 +84,7 @@ class Profile(models.Model): func = models.CharField(choices=agency_task, default="", max_length=50) # Wenn dieses Profil gelöscht wird, wird NICHT die Agency geslöscht agency = models.ForeignKey(Agency, on_delete=models.PROTECT) - image = models.ImageField(default='default.jpg', upload_to='userprofilepics', blank=True) + image = models.ImageField(default='default.jpg', upload_to='userprofilepics', blank=True, null="default.jpg") compfunc = models.CharField(max_length=60, blank=True) @@ -106,6 +113,12 @@ class Profile(models.Model): img = img.resize((wsize, baseheight), Image.ANTIALIAS) img.save(self.image.path) + @property + def get_photo_url(self): + if self.image and hasattr(self.image, 'url'): + return self.image.url + else: + return "/media/default.jpg" # PERMISSIONS - Über alle Modelle hinweg, in der url.py wird dann die route verhindert! # Im template: if perms.users.PERMISSION diff --git a/users/templates/users/agency.html b/users/templates/users/agency.html index 1ad9404..69be139 100644 --- a/users/templates/users/agency.html +++ b/users/templates/users/agency.html @@ -24,7 +24,7 @@

Agenturbild

- +

{% if perms.users.agency_change %} diff --git a/users/templates/users/dashboard.html b/users/templates/users/dashboard.html index 5957d1e..ab01c67 100644 --- a/users/templates/users/dashboard.html +++ b/users/templates/users/dashboard.html @@ -34,7 +34,7 @@
- +
diff --git a/users/templates/users/profile.html b/users/templates/users/profile.html index 8ce322d..f018159 100644 --- a/users/templates/users/profile.html +++ b/users/templates/users/profile.html @@ -3,7 +3,7 @@ {% block content %}
- +

diff --git a/users/templates/users/profile_update.html b/users/templates/users/profile_update.html index 9f7bb8d..3bb49ce 100644 --- a/users/templates/users/profile_update.html +++ b/users/templates/users/profile_update.html @@ -3,7 +3,7 @@ {% block content %}
- +