diff --git a/fedireads/migrations/0001_initial.py b/fedireads/migrations/0001_initial.py index a3d64c684..f6c3de2ed 100644 --- a/fedireads/migrations/0001_initial.py +++ b/fedireads/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.0.2 on 2020-01-28 04:47 +# Generated by Django 3.0.2 on 2020-01-28 06:21 from django.conf import settings import django.contrib.auth.models @@ -38,6 +38,7 @@ class Migration(migrations.Migration): ('actor', models.CharField(max_length=255)), ('local', models.BooleanField(default=True)), ('localname', models.CharField(blank=True, max_length=255, null=True, unique=True)), + ('avatar', models.ImageField(blank=True, null=True, upload_to='uploads/')), ('created_date', models.DateTimeField(auto_now_add=True)), ('updated_date', models.DateTimeField(auto_now=True)), ('followers', models.ManyToManyField(to=settings.AUTH_USER_MODEL)), diff --git a/fedireads/models.py b/fedireads/models.py index 6808e79d5..c682775f3 100644 --- a/fedireads/models.py +++ b/fedireads/models.py @@ -21,6 +21,7 @@ class User(AbstractUser): blank=True, unique=True ) + avatar = models.ImageField(upload_to='uploads/', blank=True, null=True) # TODO: a field for if non-local users are readers or others followers = models.ManyToManyField('self', symmetrical=False) created_date = models.DateTimeField(auto_now_add=True) diff --git a/fedireads/settings.py b/fedireads/settings.py index 598c4dbdb..4166726c4 100644 --- a/fedireads/settings.py +++ b/fedireads/settings.py @@ -128,3 +128,5 @@ USE_TZ = True # https://docs.djangoproject.com/en/2.0/howto/static-files/ STATIC_URL = '/static/' +MEDIA_URL = '/images/' +MEDIA_ROOT = os.path.join(BASE_DIR, MEDIA_URL) diff --git a/fedireads/templates/layout.html b/fedireads/templates/layout.html index 84b26e859..e57720665 100644 --- a/fedireads/templates/layout.html +++ b/fedireads/templates/layout.html @@ -26,7 +26,7 @@
{% if user.is_authenticated %}
- Welcome, {{ request.user.username }} + Welcome, {% if request.user.localname %}{{ request.user.localname }}{% else %}{{ request.user.username }}{% endif %}
{% else %} diff --git a/fedireads/templates/user.html b/fedireads/templates/user.html index b90903722..6de6f2b1b 100644 --- a/fedireads/templates/user.html +++ b/fedireads/templates/user.html @@ -3,8 +3,10 @@