pep
This commit is contained in:
parent
1af80897ac
commit
0ad5e4ae9d
|
@ -1,19 +1,19 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import unicode_literals
|
||||
from django.db import models
|
||||
from django.utils import timezone
|
||||
# from ih import images
|
||||
import os
|
||||
|
||||
|
||||
class Post(models.Model):
|
||||
name = models.CharField(max_length=30, blank=True)
|
||||
file = models.FileField(upload_to='images')
|
||||
# thumb = models.CharField(max_length=32, null=True, blank=True)
|
||||
thumb_name = property(thumb_name)
|
||||
orig_name = property(orig_name)
|
||||
|
||||
def publish(self):
|
||||
self.published_date = timezone.now()
|
||||
print(self.__dict__)
|
||||
self.save()
|
||||
|
||||
def __unicode__(self):
|
||||
|
@ -23,20 +23,6 @@ class Post(models.Model):
|
|||
x = os.path.split(self.file.name)[-1]
|
||||
return '/thumb_' + x
|
||||
|
||||
thumb_name = property(thumb_name)
|
||||
|
||||
def orig_name(self):
|
||||
|
||||
x = os.path.split(self.file.name)[-1]
|
||||
return x
|
||||
|
||||
orig_name = property(orig_name)
|
||||
|
||||
'''def resize_image(self.file):
|
||||
path, file_long = os.path.split(self.file)
|
||||
|
||||
im=image.open(file_long)
|
||||
size = 128, 128
|
||||
im.thumbnail(size)
|
||||
im.save(thumb_name)
|
||||
property(resize_image)'''
|
||||
|
|
|
@ -1,38 +1,35 @@
|
|||
{% extends 'imagehosting/base.html' %}
|
||||
|
||||
{% load static %}
|
||||
|
||||
{% block content%}
|
||||
<div class="images">
|
||||
{% for image in all %}<a href="{% url 'image_detail' pk=image.pk %}" ><img src= "/media/images{{image.thumb_name }}"></a>{% endfor %}
|
||||
</div>
|
||||
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
|
||||
<script>
|
||||
$(function() {resizer(); })
|
||||
$(window).resize(function() { resizer(); })
|
||||
<div class="images">
|
||||
{% for image in all %}<a href="{% url 'image_detail' pk=image.pk %}" ><img src= "/media/images{{image.thumb_name }}"></a>{% endfor %}
|
||||
</div>
|
||||
|
||||
function resizer() {
|
||||
var imgs = $('img');
|
||||
var row_width = $(window).width() - 50;
|
||||
console.log(row_width);
|
||||
//console.log(document.body.offsetWidth);
|
||||
var prev = [];
|
||||
var total_w = 0;
|
||||
imgs.each(function (i, e) {
|
||||
|
||||
$(this).height(200);
|
||||
prev[prev.length] = $(e);
|
||||
total_w += $(e).width();
|
||||
if (total_w > row_width) {
|
||||
prev = $(prev);
|
||||
prev.each(function (indx, element) {$(element).height(row_width*200/total_w);});
|
||||
prev = [];
|
||||
total_w = 0;
|
||||
}
|
||||
})
|
||||
//$('img').css('display', 'inline');
|
||||
}
|
||||
</script>
|
||||
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
|
||||
<script>
|
||||
$(function() {resizer(); })
|
||||
$(window).resize(function() { resizer(); })
|
||||
|
||||
function resizer() {
|
||||
var imgs = $('img');
|
||||
var row_width = $(window).width() - 50;
|
||||
var prev = [];
|
||||
var total_w = 0;
|
||||
imgs.each(function (i, e) {
|
||||
$(this).height(200);
|
||||
prev[prev.length] = $(e);
|
||||
total_w += $(e).width();
|
||||
if (total_w > row_width) {
|
||||
prev = $(prev);
|
||||
prev.each(function (indx, element) {$(element).height(row_width*200/total_w)});
|
||||
prev = [];
|
||||
total_w = 0;
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
{% endblock content %}
|
||||
|
||||
|
||||
|
|
|
@ -1,105 +1,114 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/css?family=Josefin+Sans:600" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css">
|
||||
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
|
||||
<style>
|
||||
body {margin: 0}
|
||||
.images {
|
||||
margin-top: 10px;
|
||||
margin-left: 25px;
|
||||
}
|
||||
.header {dispaly: block;
|
||||
color: black ;
|
||||
background: linear-gradient(#f3f3f3, #e0e0e0);
|
||||
//height: 50px;
|
||||
padding: 10px 25px;
|
||||
font-size: 30px
|
||||
}
|
||||
ul.menu-icon {
|
||||
display: none;
|
||||
float: right;
|
||||
color: black;
|
||||
padding: 7px 0 20px ;
|
||||
margin: 0;
|
||||
}
|
||||
.logo {
|
||||
font-family: 'Open Sans', sans-serif;
|
||||
color: #696969;
|
||||
width: 50px;
|
||||
text-decoration: none;
|
||||
}
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/css?family=Josefin+Sans:600" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css">
|
||||
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
li {
|
||||
list-style-type: none
|
||||
}
|
||||
.images {
|
||||
margin-top: 10px;
|
||||
margin-left: 25px;
|
||||
}
|
||||
|
||||
.menu {
|
||||
position: absolute;
|
||||
font-size: 20px;
|
||||
//background: linear-gradient(#f3f3f3, #e0e0e0);
|
||||
//width: 300px;
|
||||
right: 10px;
|
||||
top: 60px;
|
||||
display: none;
|
||||
}
|
||||
.menu a {
|
||||
text-align: right;
|
||||
display: inline-block;
|
||||
padding: 10px;
|
||||
background: #e0e0e0;
|
||||
//background: linear-gradient(#f3f3f3, #e0e0e0);
|
||||
width: 90%;
|
||||
//border-top:1px solid #eee;
|
||||
text-decoration: none;
|
||||
}
|
||||
.menu a:hover {
|
||||
color:#181D2B ;}
|
||||
//ul.menu-icon:hover ul.menu{display: block;}
|
||||
i {float: right;}
|
||||
.right-menu {float: right;
|
||||
padding: 12px;
|
||||
font-family: 'Open Sans', sans-serif;
|
||||
font-size: 20px;
|
||||
display: inline;
|
||||
}
|
||||
a.right-menu {
|
||||
text-decoration: none;
|
||||
color: #4368AD; padding: 9px;
|
||||
//border-left: 1px solid rgb(43, 63, 101)
|
||||
}
|
||||
.header {
|
||||
dispaly: block;
|
||||
color: black;
|
||||
background: linear-gradient(#f3f3f3, #e0e0e0);
|
||||
padding: 10px 25px;
|
||||
font-size: 30px
|
||||
}
|
||||
|
||||
@media screen and (max-width: 450px) {
|
||||
ul.menu-icon {
|
||||
display: none;
|
||||
float: right;
|
||||
color: black;
|
||||
padding: 7px 0 20px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
ul.menu-icon {display: block}
|
||||
a.right-menu {display: none}
|
||||
}
|
||||
</style>
|
||||
.logo {
|
||||
font-family: 'Open Sans', sans-serif;
|
||||
color: #696969;
|
||||
width: 50px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
li {
|
||||
list-style-type: none
|
||||
}
|
||||
|
||||
.menu {
|
||||
position: absolute;
|
||||
font-size: 20px;
|
||||
right: 10px;
|
||||
top: 60px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.menu a {
|
||||
text-align: right;
|
||||
display: inline-block;
|
||||
padding: 10px;
|
||||
background: #e0e0e0;
|
||||
width: 90%;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.menu a:hover {
|
||||
color:#181D2B;
|
||||
}
|
||||
|
||||
i {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.right-menu {
|
||||
float: right;
|
||||
padding: 12px;
|
||||
font-family: 'Open Sans', sans-serif;
|
||||
font-size: 20px;
|
||||
display: inline;
|
||||
}
|
||||
|
||||
a.right-menu {
|
||||
text-decoration: none;
|
||||
color: #4368AD;
|
||||
padding: 9px;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 450px) {
|
||||
|
||||
ul.menu-icon {display: block}
|
||||
a.right-menu {display: none}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='header'> <a href="{% url 'all_posts' %}" class='logo'>LOGO </a>
|
||||
|
||||
<a href="{% url 'image_new' %}" class='right-menu'>new image</a>
|
||||
<a href="{% url 'all_posts' %}" class='right-menu'>all images</a>
|
||||
<ul class='menu-icon'> <li> <i class="fa fa-bars"></i> </li>
|
||||
<ul class="menu">
|
||||
<li class="long"><a href="{% url 'image_new' %}">new image</a></li>
|
||||
<li class="long"><a href="{% url 'all_posts' %}">all images</a></li>
|
||||
</ul>
|
||||
</ul>
|
||||
</div>
|
||||
<div class='header'> <a href="{% url 'all_posts' %}" class='logo'>LOGO </a>
|
||||
<a href="{% url 'image_new' %}" class='right-menu'>new image</a>
|
||||
<a href="{% url 'all_posts' %}" class='right-menu'>all images</a>
|
||||
<ul class='menu-icon'>
|
||||
<li><i class="fa fa-bars"></i></li>
|
||||
<ul class="menu">
|
||||
<li class="long"><a href="{% url 'image_new' %}">new image</a></li>
|
||||
<li class="long"><a href="{% url 'all_posts' %}">all images</a></li>
|
||||
</ul>
|
||||
</ul>
|
||||
</div>
|
||||
{% block content %}
|
||||
{% endblock%}
|
||||
</body>
|
||||
<script>
|
||||
$('.menu-icon').click(function() {if ($('.menu').css('display') == 'block') {
|
||||
$('.menu').css('display', 'none') } else {
|
||||
$('.menu').css('display', 'block')
|
||||
|
||||
}})
|
||||
</script>
|
||||
</body>
|
||||
<script>
|
||||
$('.menu-icon').click(function() {if ($('.menu').css('display') == 'block') {
|
||||
$('.menu').css('display', 'none') } else {
|
||||
$('.menu').css('display', 'block')
|
||||
}})
|
||||
</script>
|
||||
</html>
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
{% load staticfiles %}
|
||||
<html>
|
||||
<head>
|
||||
<title>Gallery</title>
|
||||
</head>
|
||||
<body>
|
||||
<nav>
|
||||
<div class="nav-wrapper teal lighten-2">
|
||||
<a class="brand-logo" href="/">Gallery</a>
|
||||
</div>
|
||||
<div class="nav-wrapper teal lighten-2">
|
||||
|
||||
<ul class="right">
|
||||
<li><a href="/pfm">PFM</a>
|
||||
<li><a class="dropdown-button" href="#1" data-activates="dropdown1">Notes</a><ul id="dropdown1" class="dropdown-content"></li> <li> <a href="{% url 'blog.views.post_new' %}">new post</a></li> <li><a href="/blog/1">all notes</a></li></ul>
|
||||
<li><a class="dropdown-button" href="#2" data-activates="dropdown2">Imagehost</a><ul id="dropdown2" class="dropdown-content"></li><li> <a href="{% url 'imagehost.views.image_new' %}">new image</a></li> <li> <a href="{% url 'imagehost.views.all_posts' %}"><span>all images</span></a></li></ul>
|
||||
<li><a href="/admin">/admin</a></li>
|
||||
|
||||
</ul></div></nav>
|
||||
|
||||
|
||||
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
|
||||
<script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script>
|
||||
<script type="text/javascript" src="/js/materialize.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$('.carousel').carousel({ shift: 20 });
|
||||
$('.materialboxed').materialbox();
|
||||
$(".dropdown-button").dropdown();
|
||||
|
||||
});
|
||||
</script>
|
||||
<!--Import Google Icon Font>
|
||||
<link href="http://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"-->
|
||||
<!--Import materialize.css-->
|
||||
<link type="text/css" rel="stylesheet" href="/css/materialize.min.css" media="screen,projection">
|
||||
|
||||
<!--Let browser know website is optimized for mobile-->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<div class="card-panel teal lighten-5">
|
||||
|
||||
<div class="carousel">
|
||||
{% for image in all %}
|
||||
<a href="{% url 'image_detail' pk=image.pk %}"--> <a class="carousel-item"><img width="650" src="/media/images{{ image.thumb_name }}" ></a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-panel teal lighten-5">
|
||||
<div class="row" style="display: flex; flex-wrap: wrap;">
|
||||
{% for image in all %}
|
||||
<div class="col s12 m6 l3">
|
||||
<div class="card blue-grey darken-1"> <div class="card-content"> <img class="thumbnail" src="/media/images{{ image.thumb_name }}" ></a> </div>
|
||||
<div class="card-action white-text"><a href="{% url 'image_detail' pk=image.pk %}">{{ image.name }}</a></div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-panel s1 teal lighten-5">1</div>
|
||||
</div>
|
|
@ -2,16 +2,14 @@
|
|||
|
||||
{% block content %}
|
||||
<div class="block" style="position: relative; width: 400px; width: padding: 50px; border: 1px solid #e0e0e0; margin: 100px auto;">
|
||||
|
||||
<a href="/media/{{post.file}}"><img src="/media/images{{ post.thumb_name }}" style="margin: auto; display: block; padding: 10px"></a>
|
||||
<div style="margin: auto; display: block; padding: 10px 0 20px; width: 140px; text-align: center;">
|
||||
{% if user.is_authenticated %}
|
||||
<a href="{% url 'delete_post' pk=post.pk %}" onclick = "return confirm('Удалить?')" style="padding-right: 30px; color: #888787">удалить</a>
|
||||
{% endif %}
|
||||
<a href="/media/{{post.file}}" download style=" color: #888787; margin: auto; text-align: right"> {{ post.name }} скачать</a>
|
||||
{% if user.is_authenticated %}
|
||||
<a href="{% url 'delete_post' pk=post.pk %}" onclick = "return confirm('Удалить?')" style="padding-right: 30px; color: #888787">удалить</a>
|
||||
{% endif %}
|
||||
<a href="/media/{{post.file}}" download style=" color: #888787; margin: auto; text-align: right"> {{ post.name }} скачать</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
{% block content %}
|
||||
<div class="block" style="width: 500px; padding: 50px; margin: 100px auto; border: 1px solid #e0e0e0">
|
||||
<form method="POST" class="post-form" enctype="multipart/form-data" action="" >{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<input type="submit" value="send" class="save btn btn-default"></button>
|
||||
</form>
|
||||
<form method="POST" class="post-form" enctype="multipart/form-data" action="" >{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<input type="submit" value="send" class="save btn btn-default"></button>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
{% extends 'imagehosting/base.html' %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<form method="post" action="{% url 'login' %}" class="w3-container" style="padding: 20px">
|
||||
<table>
|
||||
{% csrf_token %}
|
||||
{{form.as_table}}
|
||||
<tr><td></td><td><input id="login" type="submit" class="w3-btn w3-right"value="login" /></td></tr>
|
||||
</table>
|
||||
|
||||
<input type="hidden" name="next" value="{{ next }}" />
|
||||
|
||||
</form>
|
||||
|
||||
<form method="post" action="{% url 'login' %}" class="w3-container" style="padding: 20px">
|
||||
<table>
|
||||
{% csrf_token %}
|
||||
{{form.as_table}}
|
||||
<tr><td></td><td><input id="login" type="submit" class="w3-btn w3-right"value="login" /></td></tr>
|
||||
</table>
|
||||
<input type="hidden" name="next" value="{{ next }}" />
|
||||
</form>
|
||||
{% endblock %}
|
|
@ -8,11 +8,11 @@ from django.contrib.staticfiles.urls import staticfiles_urlpatterns
|
|||
from django.contrib import admin
|
||||
from django.contrib.auth.views import login, logout
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^$', views.image_new, name='image_new'),
|
||||
url(r'^post/(?P<pk>[0-9]+)/$', views.image_detail, name='image_detail'),
|
||||
url(r'^all/$', views.all_posts, name='all_posts'),
|
||||
url(r'^carousel/$', views.carousel, name='carousel'),
|
||||
url(r'^delete/(?P<pk>[0-9]+)/$', views.delete_post, name='delete_post'),
|
||||
url(r'^admin/', admin.site.urls),
|
||||
url(r'^login$', login, {'template_name':'imagehosting/login.html'}, name='login'),
|
||||
|
|
|
@ -5,61 +5,30 @@ from .models import Post
|
|||
from .forms import PostForm, DeleteForm
|
||||
from django.shortcuts import redirect
|
||||
from ih import files, images
|
||||
#from django.views.decorators.csrf import requires_csrf_token
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from ih import images
|
||||
from django.views.decorators.csrf import requires_csrf_token
|
||||
|
||||
'''def create_thumbnail(request):
|
||||
# Get file from <InMemoryUploadedFile>
|
||||
file_l, filename = files.get_file_from_request(request, 'file')
|
||||
fh = files.write_to_shm(file_l, filename)
|
||||
file_l = None
|
||||
|
||||
# Create thumbnail
|
||||
thumb_name = images.resize_image(fh, {
|
||||
'name': filename,
|
||||
'size': (100, 100),
|
||||
'dest': 'mysite/media/images'
|
||||
}
|
||||
|
||||
)
|
||||
print(thumb_name)
|
||||
# Remove file from shm
|
||||
e = files.rm_from_shm(filename)
|
||||
if e is not True:
|
||||
print "WARNING: " + e
|
||||
|
||||
return thumb_name'''
|
||||
|
||||
|
||||
def create_thumb_from_file(filename):
|
||||
orig_file = 'imagehost/media/images/' + filename
|
||||
# f = str(filename)
|
||||
# print(filename)
|
||||
# print f
|
||||
# Create thumbnail
|
||||
print("DEBUG: Resizing image " + orig_file)
|
||||
thumb_name = images.resize_image(orig_file, {
|
||||
'name': filename,
|
||||
'size': [300, 300],
|
||||
'dest': 'imagehost/media/images'
|
||||
}
|
||||
|
||||
)
|
||||
|
||||
return thumb_name
|
||||
|
||||
|
||||
@login_required(login_url="/login")
|
||||
def image_new(request):
|
||||
if request.method == "POST":
|
||||
form = PostForm(request.POST, request.FILES)
|
||||
if form.is_valid():
|
||||
# thumb_name = create_thumbnail(request)
|
||||
post = form.save(commit=False)
|
||||
post.save()
|
||||
# print("FILE: ", post.file)
|
||||
print(post.orig_name)
|
||||
create_thumb_from_file(post.orig_name)
|
||||
return redirect('imagehosting.views.image_detail', pk=post.id)
|
||||
else:
|
||||
|
@ -69,20 +38,14 @@ def image_new(request):
|
|||
|
||||
def image_detail(request, pk):
|
||||
post = get_object_or_404(Post, pk=pk)
|
||||
print(post)
|
||||
return render(request, 'imagehosting/image.html', {'post': post})
|
||||
|
||||
|
||||
def all_posts(request):
|
||||
all = Post.objects.order_by('-pk')
|
||||
# page = request.POST.get("page")
|
||||
return render(request, 'imagehosting/all.html', {'all': all})
|
||||
|
||||
|
||||
def carousel(request):
|
||||
return render(request, 'imagehosting/carousel.html', {'all': Post.objects.all()})
|
||||
|
||||
#@requires_csrf_token
|
||||
@login_required(login_url="/login")
|
||||
def delete_post(request, pk):
|
||||
post_to_delete = get_object_or_404(Post, pk=pk)
|
||||
|
@ -93,6 +56,4 @@ def delete_post(request, pk):
|
|||
return HttpResponseRedirect('/admin')
|
||||
post_to_delete.delete()
|
||||
return redirect('imagehosting.views.all_posts')
|
||||
|
||||
#return render(request, 'imagehosting/delete.html', {'form': form})
|
||||
return render(request, 'imagehosting/delete.html', {'form': form})
|
|
@ -1,18 +0,0 @@
|
|||
{% extends 'base.html' %}
|
||||
|
||||
{% load pagination_tags %}
|
||||
|
||||
{% block content%}
|
||||
<div style="display: flex; width: 101%; flex-wrap: wrap; justify-content: space-between; ">
|
||||
{% for image in all %}
|
||||
<div class="block" style="margin-bottom: 1em; width: 20em; height: 20em; padding: 0.5em; float: left; position:relative; flex-wrap: wrap; ">
|
||||
<a href="{% url 'image_detail' pk=image.pk %}"><img style="position: absolute; bottom: 1em; right: 1em; " src="/media/images{{ image.thumb_name }}" padding=3%></a>
|
||||
<span style="display:inline-block; position:absolute;top:30px; left:0px; background-color:rgba(230, 230, 230,.4); padding:10px 30px;" >
|
||||
<a href="{% url 'image_detail' pk=image.pk %}">{{ image.name }}</a></span>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
{% endblock content %}
|
||||
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/css?family=Josefin+Sans:600" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css">
|
||||
|
||||
<style>
|
||||
body {margin: 0}
|
||||
.header {dispaly: block;
|
||||
color: black ;
|
||||
background: linear-gradient(#f3f3f3, #e0e0e0);
|
||||
//height: 50px;
|
||||
padding: 10px 25px;
|
||||
font-size: 30px
|
||||
}
|
||||
.menu-icon {
|
||||
display: inline-block;
|
||||
float: right;
|
||||
//color: #696969;
|
||||
color: black;
|
||||
padding: 1px;
|
||||
}
|
||||
.logo {
|
||||
font-family: 'Open Sans', sans-serif;
|
||||
color: #696969;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='header'> <span class='logo'>LOGO </span> <a class='menu-icon' href =""><i class="fa fa-bars"></i></a> </div>
|
||||
{% block content %}
|
||||
{% endblock%}
|
||||
</body>
|
||||
</html>
|
|
@ -1,62 +0,0 @@
|
|||
{% load staticfiles %}
|
||||
<html>
|
||||
<head>
|
||||
<title>Gallery</title>
|
||||
</head>
|
||||
<body>
|
||||
<nav>
|
||||
<div class="nav-wrapper teal lighten-2">
|
||||
<a class="brand-logo" href="/">Gallery</a>
|
||||
</div>
|
||||
<div class="nav-wrapper teal lighten-2">
|
||||
|
||||
<ul class="right">
|
||||
<li><a href="/pfm">PFM</a>
|
||||
<li><a class="dropdown-button" href="#1" data-activates="dropdown1">Notes</a><ul id="dropdown1" class="dropdown-content"></li> <li> <a href="{% url 'blog.views.post_new' %}">new post</a></li> <li><a href="/blog/1">all notes</a></li></ul>
|
||||
<li><a class="dropdown-button" href="#2" data-activates="dropdown2">Imagehost</a><ul id="dropdown2" class="dropdown-content"></li><li> <a href="{% url 'imagehost.views.image_new' %}">new image</a></li> <li> <a href="{% url 'imagehost.views.all_posts' %}"><span>all images</span></a></li></ul>
|
||||
<li><a href="/admin">/admin</a></li>
|
||||
|
||||
</ul></div></nav>
|
||||
|
||||
|
||||
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
|
||||
<script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script>
|
||||
<script type="text/javascript" src="/js/materialize.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$('.carousel').carousel({ shift: 20 });
|
||||
$('.materialboxed').materialbox();
|
||||
$(".dropdown-button").dropdown();
|
||||
|
||||
});
|
||||
</script>
|
||||
<!--Import Google Icon Font>
|
||||
<link href="http://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"-->
|
||||
<!--Import materialize.css-->
|
||||
<link type="text/css" rel="stylesheet" href="/css/materialize.min.css" media="screen,projection">
|
||||
|
||||
<!--Let browser know website is optimized for mobile-->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<div class="card-panel teal lighten-5">
|
||||
|
||||
<div class="carousel">
|
||||
{% for image in all %}
|
||||
<a href="{% url 'image_detail' pk=image.pk %}"--> <a class="carousel-item"><img width="650" src="/media/images{{ image.thumb_name }}" ></a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-panel teal lighten-5">
|
||||
<div class="row" style="display: flex; flex-wrap: wrap;">
|
||||
{% for image in all %}
|
||||
<div class="col s12 m6 l3">
|
||||
<div class="card blue-grey darken-1"> <div class="card-content"> <img class="thumbnail" src="/media/images{{ image.thumb_name }}" ></a> </div>
|
||||
<div class="card-action white-text"><a href="{% url 'image_detail' pk=image.pk %}">{{ image.name }}</a></div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-panel s1 teal lighten-5">1</div>
|
||||
</div>
|
|
@ -1,10 +0,0 @@
|
|||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<div> <h1>Delete</h1>
|
||||
<form method="POST">{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<button type="submit" class="save btn btn-default">delete</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -1,13 +0,0 @@
|
|||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<div class="block" style="position: relative; ">
|
||||
|
||||
<p><a href="/media/{{post.file}}"><img src="/media/images{{ post.thumb_name }}" padding=3%></a></p>
|
||||
<p><a href="/media/{{post.file}}" download> {{ post.name }} скачать </a></p>
|
||||
|
||||
<spam class="edit" style="position: absolute; bottom: 20px; right: 20px;"><a href="{% url 'delete_post' pk=post.pk %}">удалить</a></span>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<div class="block">
|
||||
<form method="POST" class="post-form" enctype="multipart/form-data" action="" >{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<input type="submit" value="send" class="save btn btn-default"></button>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
Loading…
Reference in New Issue
Block a user