Add profile_pic
This commit is contained in:
		@@ -8,7 +8,7 @@ msgid ""
 | 
			
		||||
msgstr ""
 | 
			
		||||
"Project-Id-Version: PACKAGE VERSION\n"
 | 
			
		||||
"Report-Msgid-Bugs-To: \n"
 | 
			
		||||
"POT-Creation-Date: 2020-10-11 21:53+0200\n"
 | 
			
		||||
"POT-Creation-Date: 2020-12-24 16:29+0100\n"
 | 
			
		||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 | 
			
		||||
"Last-Translator: Commander1024 <commander@commander1024.de>\n"
 | 
			
		||||
"Language-Team: LANGUAGE <LL@li.org>\n"
 | 
			
		||||
@@ -30,7 +30,7 @@ msgstr "Ungültiger Voucher"
 | 
			
		||||
msgid "Expired voucher"
 | 
			
		||||
msgstr "Abgelaufener Voucher"
 | 
			
		||||
 | 
			
		||||
#: models/abstract_models.py:29
 | 
			
		||||
#: models/abstract_models.py:29 templates/explorer/profile.html:19
 | 
			
		||||
msgid "Name"
 | 
			
		||||
msgstr "Name"
 | 
			
		||||
 | 
			
		||||
@@ -74,6 +74,16 @@ msgstr "Adresse (URL)"
 | 
			
		||||
msgid "link text"
 | 
			
		||||
msgstr "Linktext"
 | 
			
		||||
 | 
			
		||||
#: models/models.py:46
 | 
			
		||||
#, fuzzy
 | 
			
		||||
#| msgid "Filename(s)"
 | 
			
		||||
msgid "Filename"
 | 
			
		||||
msgstr "Dateiname(n)"
 | 
			
		||||
 | 
			
		||||
#: models/models.py:47
 | 
			
		||||
msgid "Optional profile pic for display in explorer profile"
 | 
			
		||||
msgstr ""
 | 
			
		||||
 | 
			
		||||
#: models/place.py:21
 | 
			
		||||
msgid "Location"
 | 
			
		||||
msgstr "Ort"
 | 
			
		||||
@@ -110,38 +120,78 @@ msgstr "Du wirst in 5 Sekunden weitergeleitet"
 | 
			
		||||
msgid "Go Back"
 | 
			
		||||
msgstr "Zurück"
 | 
			
		||||
 | 
			
		||||
#: templates/explorer/profile.html:27
 | 
			
		||||
msgid "E-Mail"
 | 
			
		||||
msgstr ""
 | 
			
		||||
 | 
			
		||||
#: templates/explorer/profile.html:35
 | 
			
		||||
msgid "Joined"
 | 
			
		||||
msgstr ""
 | 
			
		||||
 | 
			
		||||
#: templates/explorer/profile.html:43
 | 
			
		||||
#, fuzzy
 | 
			
		||||
#| msgid "All Places"
 | 
			
		||||
msgid "Places"
 | 
			
		||||
msgstr "Alle Places"
 | 
			
		||||
 | 
			
		||||
#: templates/explorer/profile.html:51
 | 
			
		||||
msgid "Place Assets"
 | 
			
		||||
msgstr ""
 | 
			
		||||
 | 
			
		||||
#: templates/explorer/profile.html:65
 | 
			
		||||
#, fuzzy
 | 
			
		||||
#| msgid "Image(s) submitted successfully"
 | 
			
		||||
msgid "Places submitted by"
 | 
			
		||||
msgstr "Bild(er) erfolgreich hinzugefügt"
 | 
			
		||||
 | 
			
		||||
#: templates/explorer/profile.html:82
 | 
			
		||||
#, fuzzy
 | 
			
		||||
#| msgid "Image(s) submitted successfully"
 | 
			
		||||
msgid "Images submitted by"
 | 
			
		||||
msgstr "Bild(er) erfolgreich hinzugefügt"
 | 
			
		||||
 | 
			
		||||
#: templates/explorer/profile.html:104
 | 
			
		||||
#, fuzzy
 | 
			
		||||
#| msgid "Photo album link submitted"
 | 
			
		||||
msgid "Photo albums submitted by"
 | 
			
		||||
msgstr "Fotoalbum-Link hinzugefügt"
 | 
			
		||||
 | 
			
		||||
#: templates/global.html:32
 | 
			
		||||
msgid "Logout"
 | 
			
		||||
msgstr "Ausloggen"
 | 
			
		||||
 | 
			
		||||
#: templates/global.html:34
 | 
			
		||||
#: templates/global.html:33
 | 
			
		||||
msgid "Profile"
 | 
			
		||||
msgstr ""
 | 
			
		||||
 | 
			
		||||
#: templates/global.html:35
 | 
			
		||||
msgid "Admin"
 | 
			
		||||
msgstr "Admin"
 | 
			
		||||
 | 
			
		||||
#: templates/global.html:39 templates/registration/login.html:4
 | 
			
		||||
#: templates/global.html:40 templates/registration/login.html:4
 | 
			
		||||
#: templates/registration/login.html:10 templates/registration/login.html:23
 | 
			
		||||
msgid "Login"
 | 
			
		||||
msgstr "Anmelden"
 | 
			
		||||
 | 
			
		||||
#: templates/global.html:40 templates/registration/login.html:29
 | 
			
		||||
#: templates/global.html:41 templates/registration/login.html:29
 | 
			
		||||
#: templates/signup.html:6 templates/signup.html:12 templates/signup.html:41
 | 
			
		||||
msgid "Sign up"
 | 
			
		||||
msgstr "Registrieren"
 | 
			
		||||
 | 
			
		||||
#: templates/global.html:50 templates/home.html:10
 | 
			
		||||
#: templates/global.html:51 templates/home.html:10
 | 
			
		||||
msgid "Home"
 | 
			
		||||
msgstr "Startseite"
 | 
			
		||||
 | 
			
		||||
#: templates/global.html:51
 | 
			
		||||
#: templates/global.html:52
 | 
			
		||||
msgid "UrBex Codex"
 | 
			
		||||
msgstr "UrBex Codex"
 | 
			
		||||
 | 
			
		||||
#: templates/global.html:56 templates/place/place_create.html:5
 | 
			
		||||
#: templates/global.html:57 templates/place/place_create.html:5
 | 
			
		||||
#: templates/place/place_create.html:10
 | 
			
		||||
msgid "Create place"
 | 
			
		||||
msgstr "Place erstellen"
 | 
			
		||||
 | 
			
		||||
#: templates/global.html:57
 | 
			
		||||
#: templates/global.html:58
 | 
			
		||||
msgid "All places"
 | 
			
		||||
msgstr "Alle Places"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -6,15 +6,28 @@
 | 
			
		||||
database.
 | 
			
		||||
'''
 | 
			
		||||
 | 
			
		||||
import os
 | 
			
		||||
import uuid
 | 
			
		||||
 | 
			
		||||
from django.db import models
 | 
			
		||||
from django.contrib.auth.models import User
 | 
			
		||||
from django.db.models.signals import post_save
 | 
			
		||||
from django.dispatch import receiver
 | 
			
		||||
from django.utils.translation import ugettext_lazy as _
 | 
			
		||||
 | 
			
		||||
from lostplaces.models.abstract_models import Expireable
 | 
			
		||||
 | 
			
		||||
from easy_thumbnails.fields import ThumbnailerImageField
 | 
			
		||||
from easy_thumbnails.files import get_thumbnailer
 | 
			
		||||
 | 
			
		||||
def generate_profile_image_filename(instance, filename):
 | 
			
		||||
    """
 | 
			
		||||
    Callback for generating filename for uploaded explorer profile images.
 | 
			
		||||
    Returns filename as: explorer_pk-username.jpg
 | 
			
		||||
    """
 | 
			
		||||
 | 
			
		||||
    return 'explorers/' + str(instance.explorer.pk) + '-' + str(instance.explorer.username) + '.' + filename.split('.')[-1]
 | 
			
		||||
 | 
			
		||||
class Explorer(models.Model):
 | 
			
		||||
    """
 | 
			
		||||
    Profile that is linked to the a User.
 | 
			
		||||
@@ -26,6 +39,15 @@ class Explorer(models.Model):
 | 
			
		||||
        on_delete=models.CASCADE,
 | 
			
		||||
        related_name='explorer'
 | 
			
		||||
    )
 | 
			
		||||
    profile_image = ThumbnailerImageField(
 | 
			
		||||
        blank=True,
 | 
			
		||||
        null=True,
 | 
			
		||||
        upload_to=generate_profile_image_filename, 
 | 
			
		||||
        resize_source=dict(size=(400, 400), 
 | 
			
		||||
        sharpen=True),
 | 
			
		||||
        verbose_name=_('Profile image'),
 | 
			
		||||
        help_text=_('Optional profile pic for display in explorer profile')
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
    def __str__(self):
 | 
			
		||||
        return self.user.username
 | 
			
		||||
@@ -58,4 +80,3 @@ class Voucher(Expireable):
 | 
			
		||||
 | 
			
		||||
    def __str__(self):
 | 
			
		||||
        return "Voucher " + str(self.code)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user