bootstrap static files

This commit is contained in:
Mateusz Grześkowiak 2018-06-16 11:22:13 +02:00
parent d0817e6d6e
commit ea3997a05a
71 changed files with 466 additions and 14 deletions

0
__init__.py Normal file
View File

BIN
__init__.pyc Normal file

Binary file not shown.

0
manage.py Normal file → Executable file
View File

Binary file not shown.

8
ordynacja/admin.py~ Normal file
View File

@ -0,0 +1,8 @@
from django.contrib import admin
# Register your models here.
from .models import Komitet, Okreg, Glosy
admin.site.register(Komitet)
admin.site.register(Okreg)
admin.site.register(Glosy)

19
ordynacja/models.py~ Normal file
View File

@ -0,0 +1,19 @@
from __future__ import unicode_literals
from django.db import models
# Create your models here.
class Komitet(models.Model):
name = models.CharField(max_length=255)
kw_id = models.IntegerField(primary_key=True)
class Okreg(models.Model):
name = models.CharField(max_length=255)
o_id = models.IntegerField(primary_key=True)
class Glos(models.Model):
g_id = models.IntegerField(primary_key=True)
liczba = models.IntegerField()
komitet = models.ForeignKey(Komitet)
okreg = models.ForeignKey(Okreg, related_name="okregi")

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,10 @@
.picture {
min-width: 50%;
min-height: 100%;
position: absolute;
margin: auto;
top: 0;
left: 0;
right: 0;
bottom: 0;
}

View File

@ -0,0 +1,4 @@
.picture {
min-width: 50%;
min-height: 100%;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

@ -0,0 +1,2 @@
console.log(glosy);
console.log(komitety);

View File

@ -0,0 +1,2 @@
console.log(glosy);
console.log(JSON.parse(komitety));

View File

@ -1,10 +1,28 @@
{% load static %}
<link rel="stylesheet" type="text/css" href="{% static "css/bootstrap.min.css" %}">
<link rel="stylesheet" type="text/css" href="{% static "css/styles.css" %}">
{% if okreg_list %}
Okreg {{ okreg_name }}
<ul>
{% for glos in okreg_list %}
<li>{{ glos.komitet.name }} - {{ glos.liczba }}</li>
{% endfor %}
</ul>
<div class="row">
<div class="col-md-6">
<img class="picture" src="{% static "img/okregi/okrag_"|add:okreg_id|add:".png" %}" alt="{{ okreg_name }}" />
</div>
<div class="col-md-6">
<ul>
{% for glos in okreg_list %}
<li>{{ glos.komitet.name }} - {{ glos.liczba }}</li>
{% endfor %}
</ul>
</div>
</div>
<script>
var glosy = {{glosy_json|safe}};
var komitety = {{komitety|safe}};
</script>
<script src="{% static "js/app.js" %}"></script>
{% else %}
<p>Wrong okreg.</p>
{% endif %}

View File

@ -1,10 +1,28 @@
{% load static %}
<link rel="stylesheet" type="text/css" href="{% static "css/bootstrap.min.css" %}">
<link rel="stylesheet" type="text/css" href="{% static "css/styles.css" %}">
{% if okreg_list %}
Okreg {{ okreg_list.objects }}
<ul>
{% for glos in okreg_list %}
<li>{{ glos.komitet.name }} - {{ glos.liczba }}</li>
{% endfor %}
</ul>
Okreg {{ okreg_name }}
<div class="row">
<div class="col-md-6">
<img class="picture" src="{% static "img/okregi/okrag_"|add:okreg_id|add:".png" %}" alt="{{ okreg_name }}" />
</div>
<div class="col-md-6">
<ul>
{% for glos in okreg_list %}
<li>{{ glos.komitet.name }} - {{ glos.liczba }}</li>
{% endfor %}
</ul>
</div>
</div>
<script>
var glosy = '{{glosy_json|safe}}';
var komitety = '{{komitety|safe}}';
</script>
<script src="{% static "js/app.js" %}"></script>
{% else %}
<p>Wrong okreg.</p>
{% endif %}

View File

@ -1,8 +1,10 @@
from django.conf.urls import url
from django.conf.urls.static import static
from django.conf import settings
from . import views
urlpatterns = [
url('^$', views.index, name='index'),
url(r'^okreg/(?P<okreg_id>\d+)/$', views.okreg, name='okreg')
]
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

Binary file not shown.

10
ordynacja/urls.py~ Normal file
View File

@ -0,0 +1,10 @@
from django.conf.urls import url
from django.conf.urls.static import static
from django.conf import settings
from . import views
urlpatterns = [
url('', views.index, name='index'),
url(r'^okreg/(?P<okreg_id>\d+)/$', views.okreg, name='okreg')
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

View File

@ -1,7 +1,8 @@
from django.shortcuts import render
from django.http import HttpResponse
from django.template import loader
from .models import Glos
from django.core import serializers
from .models import Glos,Komitet
def index(request):
@ -11,7 +12,10 @@ def okreg(request, okreg_id):
g = Glos.objects.filter(okreg__o_id=okreg_id)
template = loader.get_template('ordynacja/index.html')
context = {
'okreg_id': okreg_id,
'okreg_list': g,
'okreg_name': g[0].okreg.name
'okreg_name': g[0].okreg.name,
'glosy_json': serializers.serialize('json', g),
'komitety': serializers.serialize('json', Komitet.objects.all())
}
return HttpResponse(template.render(context, request))

Binary file not shown.

21
ordynacja/views.py~ Normal file
View File

@ -0,0 +1,21 @@
from django.shortcuts import render
from django.http import HttpResponse
from django.template import loader
from django.core import serializers
from .models import Glos,Komitet
def index(request):
return HttpResponse("This is main page. Here will be the map")
def okreg(request, okreg_id):
g = Glos.objects.filter(okreg__o_id=okreg_id)
template = loader.get_template('ordynacja/index.html')
context = {
'okreg_id': okreg_id,
'okreg_list': g,
'okreg_name': g[0].okreg.name,
'glosy_json': serializers.serialize('json', g),
'komitety': serializers.serialize('json', Komitet.objects.all())
}
return HttpResponse(template.render(context, request))

121
ordynacje/settings.py~ Normal file
View File

@ -0,0 +1,121 @@
"""
Django settings for ordynacje project.
Generated by 'django-admin startproject' using Django 1.9.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '21-xihxno3d-_aj&yh^sauesx4wgje!(owy_t!evw$t&rs+((x'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
MIDDLEWARE_CLASSES = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'ordynacje.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'ordynacje.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.9/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Password validation
# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/1.9/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.9/howto/static-files/
STATIC_URL = '/static/'

Binary file not shown.

22
ordynacje/urls.py~ Normal file
View File

@ -0,0 +1,22 @@
"""ordynacje URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url, include
from django.contrib import admin
urlpatterns = [
url(r'^ordynacja/, include('ordynacja.urls')),
url(r'^admin/', admin.site.urls),
]

20
ordynacje/wsgi.py~ Normal file
View File

@ -0,0 +1,20 @@
"""
WSGI config for ordynacje project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
path = '/home/gregz09/Pulpit/ordynacje/ordynacje'
if path not in sys.path:
sys.path.append(path)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ordynacje.settings")
application = get_wsgi_application()

122
settings.py Normal file
View File

@ -0,0 +1,122 @@
"""
Django settings for ordynacje project.
Generated by 'django-admin startproject' using Django 1.9.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '21-xihxno3d-_aj&yh^sauesx4wgje!(owy_t!evw$t&rs+((x'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'ordynacja.apps.OrdynacjaConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
MIDDLEWARE_CLASSES = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'ordynacje.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'ordynacje.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.9/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Password validation
# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/1.9/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.9/howto/static-files/
STATIC_URL = '/static/'

BIN
settings.pyc Normal file

Binary file not shown.

22
urls.py Normal file
View File

@ -0,0 +1,22 @@
"""ordynacje URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url, include
from django.contrib import admin
urlpatterns = [
url(r'^ordynacja/', include('ordynacja.urls')),
url(r'^admin/', admin.site.urls),
]

BIN
urls.pyc Normal file

Binary file not shown.

20
wsgi.py Normal file
View File

@ -0,0 +1,20 @@
"""
WSGI config for ordynacje project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os,sys
from django.core.wsgi import get_wsgi_application
path = '/home/gregz09/Pulpit/ordynacje/ordynacje'
if path not in sys.path:
sys.path.append(path)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ordynacje.settings")
application = get_wsgi_application()

BIN
wsgi.pyc Normal file

Binary file not shown.