I can't find where is a problem, I try show in template image and he don't 
show it. Please help...

my code

models

from django.db import models
from django.contrib.auth.models import AbstractUser

##################################################

class MysiteUser(AbstractUser):
    avatar = models.ImageField(upload_to="avatar")

    def __str__(self):
        return self.username



template

<!DOCTYPE html>
<html lang="pl">
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
{% load staticfiles %}

{% block content %}
    {% if user.is_authenticated %}
            Mój profil  {{ user.username }} </br>
            <img src="{{ user.avatar.url }}" width="200" height="200" 
border="1" />
            <a href="{% url 'users:logout-view' %}">Wyloguj się</a>
    {% else %}
        {% block logout %}
            Nie jesteś zalogowany

        {% endblock %}
    {% endif %}
{% endblock %}
</body>
</html>



url

from django.conf.urls import  include, url
from django.contrib import admin
from users.views import LoginView
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
    url(r'^admin/', include(admin.site.urls)),
    url(r'^users/', include('users.urls', namespace='users')),
    url(r'^$', LoginView.as_view(), name='login-view'),


]

static(settings.MEDIA_URL, document_root = settings.MEDIA_ROOT)



settings

MEDIA_ROOT = '/mysite/media/'
MEDIA_URL = '/media/'

STATIC_URL = '/static/'

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7bd304b4-91dc-4e6f-89e6-60c0998869fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to