Commit 86fd7ff2 authored by Robert's avatar Robert

replaced static logo by group field

parent faf89ab1
db.sqlite3
__pycache__
db.sqlite3
media
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2015-12-26 12:32
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('entities', '0003_gestalt'),
]
operations = [
migrations.AddField(
model_name='group',
name='logo',
field=models.ImageField(blank=True, upload_to=''),
),
]
......@@ -9,6 +9,7 @@ class Group(models.Model):
address = models.TextField(blank=True)
date_created = models.DateField(auto_now_add=True)
date_founded = models.DateField(null=True, blank=True)
logo = models.ImageField(blank=True)
name = models.CharField(max_length=255)
slug = models.SlugField()
url = models.URLField(blank=True)
......
......@@ -8,7 +8,9 @@
<div class="row">
<div class="col-md-6"></div>
<div class="col-md-6">
<img class="pull-right" src="{% static 'logo.png' %}">
{% if group.logo %}
<img src="{{ group.logo.url }}" class="pull-right">
{% endif %}
<h1>{{ group.name }}</h1>
<ul>
<li>{{ group.address|linebreaks }}</li>
......
......@@ -127,6 +127,10 @@ USE_TZ = True
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR),
]
# User uploaded files
# https://docs.djangoproject.com/en/1.9/topics/files/
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
from django.conf.urls import url
from django.conf import settings
from django.conf.urls import static, url
from django.contrib import admin
from entities import views as entities_views
......@@ -7,4 +8,4 @@ from entities import views as entities_views
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^(?P<slug>[\w-]+)$', entities_views.GroupDetailView.as_view()),
]
] + static.static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment