Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
A
Aspava
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
Aspava
Commits
f8dce46b
Kaydet (Commit)
f8dce46b
authored
May 05, 2019
tarafından
Batuhan Taşkaya
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Profiles
üst
5d9dc30a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
68 additions
and
5 deletions
+68
-5
settings.py
aspava/settings.py
+1
-0
0003_socialuser_avatar.py
social/migrations/0003_socialuser_avatar.py
+18
-0
models.py
social/models.py
+5
-1
profile.html
social/templates/user/profile.html
+34
-0
urls.py
social/urls.py
+3
-2
views.py
social/views.py
+7
-2
No files found.
aspava/settings.py
Dosyayı görüntüle @
f8dce46b
...
...
@@ -127,3 +127,4 @@ AUTH_USER_MODEL = 'social.SocialUser'
# Extra Settings
MAX_POST_LENGTH
=
144
*
2
AVATAR
=
'http://www.iconarchive.com/download/i106224/papirus-team/papirus-apps/python.ico'
social/migrations/0003_socialuser_avatar.py
0 → 100644
Dosyayı görüntüle @
f8dce46b
# Generated by Django 2.2.1 on 2019-05-05 07:54
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'social'
,
'0002_snippet'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'socialuser'
,
name
=
'avatar'
,
field
=
models
.
URLField
(
blank
=
True
,
default
=
'http://www.iconarchive.com/download/i106224/papirus-team/papirus-apps/python.ico'
),
),
]
social/models.py
Dosyayı görüntüle @
f8dce46b
...
...
@@ -3,7 +3,11 @@ from django.conf import settings
from
django.contrib.auth.models
import
AbstractUser
class
SocialUser
(
AbstractUser
):
pass
avatar
=
models
.
URLField
(
blank
=
True
,
default
=
settings
.
AVATAR
)
@property
def
slug
(
self
):
return
self
.
username
class
Sharable
(
models
.
Model
):
class
Meta
:
...
...
social/templates/user/profile.html
0 → 100644
Dosyayı görüntüle @
f8dce46b
{% extends 'base.html' %}
{% block title %}Profile{% endblock %}
{% block css %}
<style>
.container
{
width
:
100%
;
height
:
200px
;
margin
:
auto
;
padding
:
10px
;
}
.avatar
{
width
:
45%
;
height
:
200px
;
float
:
left
;
}
.content
{
margin-left
:
45%
;
height
:
200px
;
}
</style>
{% endblock %}
{% block content %}
<section
class=
"container"
>
<div
class=
"avatar"
>
<img
src=
"{{ object.avatar }}"
alt=
"{{ object.username }}'s Avatar"
>
</div>
<div
class=
"content"
>
<h3>
{{ object.username }}
</h3>
<ul>
<li>
Mail: {{ object.email }}
</li>
</ul>
</div>
</section>
{% endblock %}
social/urls.py
Dosyayı görüntüle @
f8dce46b
...
...
@@ -2,7 +2,7 @@ from collections import UserList
from
dataclasses
import
dataclass
from
typing
import
Optional
,
Sequence
from
django.urls
import
include
,
path
from
social.views
import
Home
,
Register
from
social.views
import
Home
,
Register
,
Profile
@dataclass
(
frozen
=
True
,
unsafe_hash
=
True
)
...
...
@@ -84,8 +84,9 @@ class PatternManager:
class
SocialPatterns
(
PatternManager
,
UserList
):
home
=
""
,
Home
user
=
"people/<slug>/"
,
Profile
register
=
"accounts/register/"
,
Register
includes
=
{
"accounts"
:
IncludeFilter
(
"django.contrib.auth.urls"
,
whitelist
=
(
"login"
,
"logout"
)
...
...
social/views.py
Dosyayı görüntüle @
f8dce46b
...
...
@@ -2,10 +2,10 @@ from itertools import chain
from
django.contrib.auth.forms
import
UserCreationForm
from
django.urls
import
reverse_lazy
from
django.views.generic
import
CreateView
,
ListView
from
django.views.generic
import
CreateView
,
ListView
,
DetailView
from
django.views.generic.base
import
TemplateView
from
social.models
import
Post
,
Snippet
from
django.contrib.auth
import
get_user_model
class
ExtendedListView
(
ListView
):
def
get_queryset
(
self
):
...
...
@@ -25,3 +25,8 @@ class Register(CreateView):
form_class
=
UserCreationForm
success_url
=
reverse_lazy
(
'login'
)
template_name
=
'registration/register.html'
class
Profile
(
DetailView
):
model
=
get_user_model
()
slug_field
=
'username'
template_name
=
'user/profile.html'
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment