Commit 39ce26bc authored by barni2000's avatar barni2000
Browse files

Merge branch 'uikit' into 'master'

Uikit



See merge request !1
parents c3be1085 f3dd3140
# Entries
## Projektről
TODO
## Függöségek
- python3
- django == 1.9.5
- pillow
- bower
- jquery
- uikit
- sass
## Telepítés
````pip install django==1.9.5````
````pip install pillow````
````bower install````
````sassc sass/base.sass sass/base.css````
````./manage.py migrate````
````./manage.py runserver````
{
"name": "entries",
"authors": [
"DevTeam"
],
"description": "",
"main": "",
"license": "None",
"homepage": "",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
]
}
......@@ -37,7 +37,7 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'pityu'
'web'
]
MIDDLEWARE_CLASSES = [
......@@ -56,8 +56,7 @@ ROOT_URLCONF = 'entries.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')]
,
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
......@@ -107,4 +106,9 @@ LOGIN_URL = '/login/'
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.9/howto/static-files/
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'bower_components'),
os.path.join(BASE_DIR, 'static')
]
STATIC_URL = '/static/'
from django.conf.urls import url, include
from django.contrib import admin
from pityu.urls import url_patterns
from django.contrib import admin, auth
from web.urls import url_patterns
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^login/$', 'django.contrib.auth.views.login', name='login'),
url(r'^logout/$', 'django.contrib.auth.views.logout', {'next_page': '/'}, name='logout'),
url(r'^login/$', auth.views.login, name='login'),
url(r'^logout/$', auth.views.logout, {'next_page': '/'}, name='logout'),
url(r'^', include(url_patterns)),
]
html
background-image: url('../images/body-bg.gif')
{% load staticfiles %}
<!DOCTYPE html>
<html lang="en">
<head>
......@@ -6,27 +7,61 @@
{% endblock %}
<title>{% block title %}Awsome entries{% endblock %}</title>
<link rel="stylesheet" type="text/css" href="{% static 'uikit/css/uikit.gradient.min.css' %}"/>
<link rel="stylesheet" type="text/css" href="{% static 'css/base.css' %}">
</head>
<body>
<h1>Awsome entries!</h1>
{% if user.is_authenticated %}
<p>Hello, {{ user }}!</p>
{% endif %}
<a href="{% url 'home' %}">Home</a>
<div class="uk-width-small-5-6 uk-width-medium-1-2 uk-width-large-1-2 uk-container-center">
{% if user.is_authenticated %}
<a href="{% url 'create_entry' %}">New entry</a>
<a href="{% url 'logout' %}">Logout</a>
{% else %}
<a href="{% url 'login' %}">Login</a>
{% endif %}
<nav class="uk-navbar uk-margin-top uk-margin-bottom">
<a href="{% url 'home' %}" class="uk-navbar-brand uk-hidden-small">Free Entries</a>
<ul class="uk-navbar-nav uk-hidden-small">
<li><a href="{% url 'home' %}">Home</a></li>
<hr>
{% if user.is_authenticated %}
<li><a href="{% url 'create_entry' %}">New entry</a></li>
<li><a href="{% url 'logout' %}">Logout</a></li>
{% else %}
<li><a href="{% url 'login' %}">Login</a></li>
{% endif %}
</ul>
{% block content %}
<ul class="uk-navbar-nav uk-hidden-medium uk-hidden-large">
<li><a href="#main-offcanvas" data-uk-offcanvas><i class="uk-icon-bars"></i> Menu</a></li>
</ul>
</nav>
{% endblock %}
<div id="main-offcanvas" class="uk-offcanvas">
<div class="uk-offcanvas-bar">
<ul class="uk-nav uk-nav-offcanvas" data-uk-nav>
<li><a href="{% url 'home' %}">Home</a></li>
{% if user.is_authenticated %}
<li><a href="{% url 'create_entry' %}">New entry</a></li>
<li><a href="{% url 'logout' %}">Logout</a></li>
{% else %}
<li><a href="{% url 'login' %}">Login</a></li>
{% endif %}
</ul>
</div>
</div>
{% if user.is_authenticated %}
<div class="uk-alert uk-alert-success" data-uk-alert>
<a href="" class="uk-alert-close uk-close"></a>
<p>Hello, {{ user }}!</p>
</div>
{% endif %}
{% block content %}
{% endblock %}
</div>
<script src="{% static 'jquery/dist/jquery.min.js' %}"></script>
<script src="{% static 'uikit/js/uikit.min.js' %}"></script>
</body>
</html>
\ No newline at end of file
</html>
{% extends 'base.html' %}
{% block content %}
<form action="" method="post">
{% csrf_token %}
<div class="uk-panel uk-panel-box">
<form class="uk-form" action="" method="post">
{% csrf_token %}
{% for paragraph in form %}
<div class="uk-form-row uk-form-stacked">
<label class="uk-form-label" for="">{{ paragraph.label }}</label>
<div class="uk-form-controls">{{ paragraph }}</div>
</div>
{% endfor %}
<input class="uk-button uk-button-primary uk-margin-top uk-align-right" type="submit">
{{ form.as_p }}
<input type="submit">
</form>
</form>
</div>
{% endblock %}
{% extends 'base.html' %}
{% block title %}
Barni
{% endblock %}
{% block css %}
<style>
.entry{
margin: 15px;
padding: 5px;
border: solid 1px black;
}
</style>
Free Entries
{% endblock %}
{% block content %}
{% for entry in entries %}
<div class="entry">
<h3>{{ entry.title }}</h3>
<p>{{ entry.description }}</p>
<a href="{{ entry.url }}">Click!!</a>
</div>
<div class="uk-panel uk-panel-box uk-margin-bottom">
<h3 class="uk-panel-title">{{ entry.title }}</h3>
<p>{{ entry.description }}</p>
<a href="{{ entry.url }}">Click!!</a>
</div>
{% empty %}
No entries.
{% endfor %}
{% endblock %}
\ No newline at end of file
{% endblock %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Login</title>
</head>
<body>
<form action="{% url 'login' %}?next={{ next }}" method="post">
{% csrf_token %}
{{ form }}
<input type="hidden" value="{{ next }}">
<input type="submit">
</form>
</body>
</html>
\ No newline at end of file
{% extends 'base.html'%}
{% block title %}
Login
{% endblock %}
{% block content%}
<div class="uk-panel uk-panel-box">
<form class="uk-form" action="{% url 'login' %}?next={{ next }}" method="post">
{% csrf_token %}
{{ form.as_p }}
<input type="hidden" value="{{ next }}">
<button class="uk-button uk-button-primary" type="submit">Login</button>
</form>
<div>
{% endblock %}
from django.contrib import admin
from .models import Entry
class EntryAdmin(admin.ModelAdmin):
pass
......
from django.apps import AppConfig
class PityuConfig(AppConfig):
name = 'pityu'
class WebConfig(AppConfig):
name = 'web'
from django.db import models
from django.contrib.auth.models import User
class Entry(models.Model):
title = models.CharField(max_length=60)
description = models.TextField(blank=True)
......
......@@ -5,7 +5,6 @@ from django.contrib.auth.mixins import LoginRequiredMixin
from .models import Entry
def home(request):
entries = Entry.objects.all()
......
Supports Markdown
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