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
d1956389
Kaydet (Commit)
d1956389
authored
May 12, 2019
tarafından
Batuhan Taşkaya
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
sectioned view
üst
fbf9ac1b
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
61 additions
and
5 deletions
+61
-5
0007_auto_20190511_2316.py
social/migrations/0007_auto_20190511_2316.py
+18
-0
models.py
social/models.py
+1
-1
main.js
social/static/js/main.js
+9
-0
base.html
social/templates/base.html
+2
-0
link.html
social/templates/forms/create/link.html
+1
-0
post.html
social/templates/forms/create/post.html
+1
-0
snippet.html
social/templates/forms/create/snippet.html
+1
-0
link.html
social/templates/forms/delete/link.html
+1
-0
post.html
social/templates/forms/delete/post.html
+1
-0
snippet.html
social/templates/forms/delete/snippet.html
+1
-0
link.html
social/templates/forms/update/link.html
+1
-0
post.html
social/templates/forms/update/post.html
+1
-0
snippet.html
social/templates/forms/update/snippet.html
+1
-0
home.html
social/templates/home.html
+1
-3
__init__.py
social/views/__init__.py
+21
-1
No files found.
social/migrations/0007_auto_20190511_2316.py
0 → 100644
Dosyayı görüntüle @
d1956389
# Generated by Django 2.2.1 on 2019-05-11 23:16
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'social'
,
'0006_auto_20190507_1848'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'sharable'
,
name
=
'pub_date'
,
field
=
models
.
DateTimeField
(
auto_now
=
True
),
),
]
social/models.py
Dosyayı görüntüle @
d1956389
...
...
@@ -27,7 +27,7 @@ class Sharable(models.Model):
author
=
models
.
ForeignKey
(
settings
.
AUTH_USER_MODEL
,
on_delete
=
models
.
CASCADE
)
pub_date
=
models
.
TimeField
(
auto_now
=
True
)
pub_date
=
models
.
Date
TimeField
(
auto_now
=
True
)
def
__str__
(
self
):
return
f
"{self.__class__.__name__}@{self.author}"
...
...
social/static/js/main.js
Dosyayı görüntüle @
d1956389
...
...
@@ -13,3 +13,12 @@ function getCookie(c_name)
}
return
""
;
}
$
(
'.js-captcha-refresh'
).
click
(
function
()
{
$
.
getJSON
(
"/captcha/refresh/"
,
function
(
result
)
{
$
(
'.captcha'
).
attr
(
'src'
,
result
[
'image_url'
]);
$
(
'#id_captcha_0'
).
val
(
result
[
'key'
])
});
});
social/templates/base.html
Dosyayı görüntüle @
d1956389
...
...
@@ -61,6 +61,8 @@
</main>
{% bootstrap_javascript jquery='full' %}
{% block js %}{% endblock %}
{% load static %}
<script
src=
"{% static 'js/main.js' %}"
></script>
</body>
</html>
social/templates/forms/create/link.html
Dosyayı görüntüle @
d1956389
...
...
@@ -10,6 +10,7 @@
{% csrf_token %}
{% bootstrap_form form %}
{% buttons %}
<button
class=
'js-captcha-refresh'
>
Refresh Captcha
</button>
<button
type=
"submit"
class=
"btn btn-primary"
>
Post link
</button>
{% endbuttons %}
</form>
...
...
social/templates/forms/create/post.html
Dosyayı görüntüle @
d1956389
...
...
@@ -10,6 +10,7 @@
{% csrf_token %}
{% bootstrap_form form %}
{% buttons %}
<button
class=
'js-captcha-refresh'
>
Refresh Captcha
</button>
<button
type=
"submit"
class=
"btn btn-primary"
>
Post
</button>
{% endbuttons %}
</form>
...
...
social/templates/forms/create/snippet.html
Dosyayı görüntüle @
d1956389
...
...
@@ -10,6 +10,7 @@
{% csrf_token %}
{% bootstrap_form form %}
{% buttons %}
<button
class=
'js-captcha-refresh'
>
Refresh Captcha
</button>
<button
type=
"submit"
class=
"btn btn-primary"
>
Post snippet
</button>
{% endbuttons %}
</form>
...
...
social/templates/forms/delete/link.html
Dosyayı görüntüle @
d1956389
...
...
@@ -16,6 +16,7 @@
<form
method=
"post"
class=
"form"
>
{% csrf_token %}
{% buttons %}
<button
class=
'js-captcha-refresh'
>
Refresh Captcha
</button>
<button
type=
"submit"
class=
"btn btn-primary"
value=
"Confirm"
>
Delete Link
</button>
{% endbuttons %}
</form>
...
...
social/templates/forms/delete/post.html
Dosyayı görüntüle @
d1956389
...
...
@@ -16,6 +16,7 @@
<form
method=
"post"
class=
"form"
>
{% csrf_token %}
{% buttons %}
<button
class=
'js-captcha-refresh'
>
Refresh Captcha
</button>
<button
type=
"submit"
class=
"btn btn-primary"
value=
"Confirm"
>
Delete Post
</button>
{% endbuttons %}
</form>
...
...
social/templates/forms/delete/snippet.html
Dosyayı görüntüle @
d1956389
...
...
@@ -16,6 +16,7 @@
<form
method=
"post"
class=
"form"
>
{% csrf_token %}
{% buttons %}
<button
class=
'js-captcha-refresh'
>
Refresh Captcha
</button>
<button
type=
"submit"
class=
"btn btn-primary"
value=
"Confirm"
>
Delete Snippet
</button>
{% endbuttons %}
</form>
...
...
social/templates/forms/update/link.html
Dosyayı görüntüle @
d1956389
...
...
@@ -10,6 +10,7 @@
{% csrf_token %}
{% bootstrap_form form %}
{% buttons %}
<button
class=
'js-captcha-refresh'
>
Refresh Captcha
</button>
<button
type=
"submit"
class=
"btn btn-primary"
>
Update Link
</button>
{% endbuttons %}
</form>
...
...
social/templates/forms/update/post.html
Dosyayı görüntüle @
d1956389
...
...
@@ -10,6 +10,7 @@
{% csrf_token %}
{% bootstrap_form form %}
{% buttons %}
<button
class=
'js-captcha-refresh'
>
Refresh Captcha
</button>
<button
type=
"submit"
class=
"btn btn-primary"
>
Update Post
</button>
{% endbuttons %}
</form>
...
...
social/templates/forms/update/snippet.html
Dosyayı görüntüle @
d1956389
...
...
@@ -10,6 +10,7 @@
{% csrf_token %}
{% bootstrap_form form %}
{% buttons %}
<button
class=
'js-captcha-refresh'
>
Refresh Captcha
</button>
<button
type=
"submit"
class=
"btn btn-primary"
>
Update Snippet
</button>
{% endbuttons %}
</form>
...
...
social/templates/home.html
Dosyayı görüntüle @
d1956389
...
...
@@ -8,7 +8,7 @@
{% block content %}
{% load renderer %}
{% load likes_inclusion_tags %}
{% for item in
feed
%}
{% for item in
this_day
%}
<div
class=
"container-fluid __{{ item | get_class }}"
>
<fieldset
class=
"border p-2"
>
<legend
class=
"w-auto"
><a
href=
"{% url 'profile' item.author %}"
>
{{ item.author }}
</a></legend>
...
...
@@ -24,10 +24,8 @@
{% endfor %}
{% endblock %}
{% block js %}
{% load static %}
<script
src=
"//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/highlight.min.js"
></script>
<script>
hljs
.
initHighlightingOnLoad
();
</script>
<script
src=
"{% static 'js/main.js' %}"
></script>
<script>
$
(
function
()
{
$
(
'button'
).
on
(
'click'
,
function
()
{
...
...
social/views/__init__.py
Dosyayı görüntüle @
d1956389
...
...
@@ -3,6 +3,9 @@ import docker.errors
from
django.views.decorators.csrf
import
csrf_exempt
from
django.http
import
JsonResponse
from
django.shortcuts
import
get_object_or_404
from
django.utils
import
timezone
from
datetime
import
datetime
,
timedelta
from
functools
import
partial
from
evality
import
Evality
from
purima.views
import
ExtendedListView
...
...
@@ -19,10 +22,27 @@ class Home(ExtendedListView):
template_name
=
"home.html"
context_object_name
=
"feed"
def
date_sorted
(
self
,
qs
,
to_date
,
from_date
):
return
list
(
filter
(
lambda
item
:
from_date
<
item
.
pub_date
<
to_date
,
qs
))
def
get_queryset
(
self
):
qs
=
list
(
super
()
.
get_queryset
())
qs
.
sort
(
key
=
(
lambda
item
:
item
.
id
))
qs
.
sort
(
key
=
(
lambda
item
:
item
.
vote_total
))
return
reversed
(
qs
)
def
get_context_data
(
self
):
context
=
super
()
.
get_context_data
()
context
[
'all_time'
]
=
list
(
context
.
pop
(
self
.
context_object_name
))
now
=
timezone
.
now
()
date_sorted
=
partial
(
self
.
date_sorted
,
context
[
'all_time'
],
now
)
context
[
'this_year'
]
=
date_sorted
(
now
-
timedelta
(
365
))
context
[
'this_month'
]
=
date_sorted
(
now
-
timedelta
(
30
))
context
[
'this_week'
]
=
date_sorted
(
now
-
timedelta
(
7
))
context
[
'this_day'
]
=
date_sorted
(
now
-
timedelta
(
1
))
return
context
@csrf_exempt
def
run_snippet
(
request
):
...
...
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