diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..b0af3886860594515460f1df3d25c624bed52200
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,107 @@
+__pycache__
+*.py[cod]
+*$py.class
+
+# Distribution / packaging
+.Python build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+.eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+wheels/
+*.egg-info/
+.installed.cfg
+*.egg
+*.manifest
+*.spec
+
+# Log files
+pip-log.txt
+pip-delete-this-directory.txt
+*.log
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.coverage
+.coverage.*
+.cache
+.pytest_cache/
+nosetests.xml
+coverage.xml
+*.cover
+.hypothesis/
+
+# Translations
+*.mo
+*.pot
+
+# PyBuilder
+target/
+
+# Jupyter Notebook
+.ipynb_checkpoints
+
+# IPython
+profile_default/
+ipython_config.py
+
+# pyenv
+.python-version
+
+# pyflow
+__pypackages__/
+
+# Environment
+.env
+.venv
+env/
+venv/
+ENV/
+
+# If you are using PyCharm #
+.idea/**/workspace.xml
+.idea/**/tasks.xml
+.idea/dictionaries
+.idea/**/dataSources/
+.idea/**/dataSources.ids
+.idea/**/dataSources.xml
+.idea/**/dataSources.local.xml
+.idea/**/sqlDataSources.xml
+.idea/**/dynamic.xml
+.idea/**/uiDesigner.xml
+.idea/**/gradle.xml
+.idea/**/libraries
+*.iws /out/
+
+# Sublime Text
+*.tmlanguage.cache
+*.tmPreferences.cache
+*.stTheme.cache
+*.sublime-workspace
+*.sublime-project
+
+# sftp configuration file
+sftp-config.json
+
+# Package control specific files Package
+Control.last-run
+Control.ca-list
+Control.ca-bundle
+Control.system-ca-bundle
+GitHub.sublime-settings
+
+# Visual Studio Code #
+.vscode/*
+!.vscode/settings.json
+!.vscode/tasks.json
+!.vscode/launch.json
+!.vscode/extensions.json
+.history
+db.sqlite3
diff --git a/django_apps/__init__.py b/django_apps/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/django_apps/asgi.py b/django_apps/asgi.py
new file mode 100644
index 0000000000000000000000000000000000000000..a7702149a9cd14e5743fb2ff49bb2d9ed3056cc6
--- /dev/null
+++ b/django_apps/asgi.py
@@ -0,0 +1,16 @@
+"""
+ASGI config for django_apps project.
+
+It exposes the ASGI callable as a module-level variable named ``application``.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
+"""
+
+import os
+
+from django.core.asgi import get_asgi_application
+
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_apps.settings')
+
+application = get_asgi_application()
diff --git a/django_apps/settings.py b/django_apps/settings.py
new file mode 100644
index 0000000000000000000000000000000000000000..2fca22b0505bf8a1e40ab303c647483ca1e8af68
--- /dev/null
+++ b/django_apps/settings.py
@@ -0,0 +1,133 @@
+"""
+Django settings for django_apps project.
+
+Generated by 'django-admin startproject' using Django 3.2.3.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/3.2/topics/settings/
+
+For the full list of settings and their values, see
+https://docs.djangoproject.com/en/3.2/ref/settings/
+"""
+
+from pathlib import Path
+
+# Build paths inside the project like this: BASE_DIR / 'subdir'.
+BASE_DIR = Path(__file__).resolve().parent.parent
+
+
+# Quick-start development settings - unsuitable for production
+# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
+
+# SECURITY WARNING: keep the secret key used in production secret!
+SECRET_KEY = 'django-insecure-kog+-x*xtt5e7shmxa-ddldzdtz@u#*tj^s9jzm#%&ghy*a8x%'
+
+# SECURITY WARNING: don't run with debug turned on in production!
+DEBUG = True
+
+ALLOWED_HOSTS = []
+
+
+# Application definition
+    #'polls.apps.PollsConfig',
+
+INSTALLED_APPS = [
+    'sifrovacka.apps.SifrovackaConfig',
+    'django_registration',
+    'django.contrib.admin',
+    'django.contrib.auth',
+    'django.contrib.contenttypes',
+    'django.contrib.sessions',
+    'django.contrib.messages',
+    'django.contrib.staticfiles',
+]
+
+MIDDLEWARE = [
+    'django.middleware.security.SecurityMiddleware',
+    'django.contrib.sessions.middleware.SessionMiddleware',
+    'django.middleware.common.CommonMiddleware',
+    'django.middleware.csrf.CsrfViewMiddleware',
+    'django.contrib.auth.middleware.AuthenticationMiddleware',
+    'django.contrib.messages.middleware.MessageMiddleware',
+    'django.middleware.clickjacking.XFrameOptionsMiddleware',
+]
+
+ROOT_URLCONF = 'django_apps.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 = 'django_apps.wsgi.application'
+
+
+# Database
+# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
+
+DATABASES = {
+    'default': {
+        'ENGINE': 'django.db.backends.sqlite3',
+        'NAME': BASE_DIR / 'db.sqlite3',
+    }
+}
+
+
+# Password validation
+# https://docs.djangoproject.com/en/3.2/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/3.2/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/3.2/howto/static-files/
+
+STATIC_URL = '/static/'
+
+# Default primary key field type
+# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
+
+DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
+
+# Custom settings AUTH
+
+LOGIN_REDIRECT_URL = 'home'
+LOGOUT_REDIRECT_URL = 'index'
diff --git a/django_apps/urls.py b/django_apps/urls.py
new file mode 100644
index 0000000000000000000000000000000000000000..d3c3f95b70ce0af72b597b482f4b954fee07497e
--- /dev/null
+++ b/django_apps/urls.py
@@ -0,0 +1,23 @@
+"""django_apps URL Configuration
+
+The `urlpatterns` list routes URLs to views. For more information please see:
+    https://docs.djangoproject.com/en/3.2/topics/http/urls/
+Examples:
+Function views
+    1. Add an import:  from my_app import views
+    2. Add a URL to urlpatterns:  path('', views.home, name='home')
+Class-based views
+    1. Add an import:  from other_app.views import Home
+    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
+Including another URLconf
+    1. Import the include() function: from django.urls import include, path
+    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
+"""
+from django.contrib import admin
+from django.urls import path, include
+
+urlpatterns = [
+#    path('polls/', include('polls.urls')),
+    path('sifrovacka/', include('sifrovacka.urls')),
+    path('admin/', admin.site.urls),
+]
diff --git a/django_apps/wsgi.py b/django_apps/wsgi.py
new file mode 100644
index 0000000000000000000000000000000000000000..59f36f6d29e86c37032e699c3ef55184599ec3f1
--- /dev/null
+++ b/django_apps/wsgi.py
@@ -0,0 +1,16 @@
+"""
+WSGI config for django_apps 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/3.2/howto/deployment/wsgi/
+"""
+
+import os
+
+from django.core.wsgi import get_wsgi_application
+
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_apps.settings')
+
+application = get_wsgi_application()
diff --git a/manage.py b/manage.py
new file mode 100755
index 0000000000000000000000000000000000000000..70e5b4f824f5d0e38dc44a78a9707b4d7727c4a9
--- /dev/null
+++ b/manage.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+"""Django's command-line utility for administrative tasks."""
+import os
+import sys
+
+
+def main():
+    """Run administrative tasks."""
+    os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_apps.settings')
+    try:
+        from django.core.management import execute_from_command_line
+    except ImportError as exc:
+        raise ImportError(
+            "Couldn't import Django. Are you sure it's installed and "
+            "available on your PYTHONPATH environment variable? Did you "
+            "forget to activate a virtual environment?"
+        ) from exc
+    execute_from_command_line(sys.argv)
+
+
+if __name__ == '__main__':
+    main()
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000000000000000000000000000000000000..83d66431530342db426469989fa4a293a3928085
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,49 @@
+appdirs==1.4.4
+asgiref==3.3.4
+asn1crypto==1.4.0
+backcall==0.2.0
+cffi==1.14.6
+confusable-homoglyphs==3.2.0
+cryptography==3.3.2
+dbus-python==1.2.16
+decorator==5.0.9
+distlib==0.3.1
+Django==3.2.3
+django-registration==3.2
+entrypoints==0.3
+filelock==3.0.12
+importlib-metadata==1.6.0
+ipython==7.27.0
+ipython-genutils==0.2.0
+jedi==0.18.0
+jeepney==0.6.0
+keyring==22.0.1
+keyrings.alt==4.0.2
+Mako==1.1.3
+Markdown==3.3.4
+MarkupSafe==1.1.1
+matplotlib-inline==0.1.2
+more-itertools==4.2.0
+parso==0.8.2
+pexpect==4.8.0
+pickleshare==0.7.5
+prompt-toolkit==3.0.20
+ptyprocess==0.7.0
+pycairo==1.20.1
+pycparser==2.20
+pycrypto==2.6.1
+pycryptodomex==3.9.7
+Pygments==2.7.1
+PyGObject==3.38.0
+pytz==2021.1
+pyxdg==0.27
+PyYAML==5.3.1
+SecretStorage==3.3.1
+six==1.16.0
+sqlparse==0.4.1
+traitlets==5.0.5
+typing-extensions==3.10.0.0
+virtualenv==20.4.0+ds
+wcwidth==0.2.5
+xdg==5
+zipp==1.0.0
diff --git a/sifrovacka/__init__.py b/sifrovacka/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/sifrovacka/admin.py b/sifrovacka/admin.py
new file mode 100644
index 0000000000000000000000000000000000000000..30aa8666949934afc40e04d4e2a0536b14d10d08
--- /dev/null
+++ b/sifrovacka/admin.py
@@ -0,0 +1,9 @@
+from django.contrib import admin
+
+# Register your models here.
+
+from . import models
+
+admin.site.register(models.Sifrovacka)
+admin.site.register(models.Stages)
+admin.site.register(models.Participants)
diff --git a/sifrovacka/apps.py b/sifrovacka/apps.py
new file mode 100644
index 0000000000000000000000000000000000000000..87991adda38983029e3919c9dcf547922c95a1ad
--- /dev/null
+++ b/sifrovacka/apps.py
@@ -0,0 +1,6 @@
+from django.apps import AppConfig
+
+
+class SifrovackaConfig(AppConfig):
+    default_auto_field = 'django.db.models.BigAutoField'
+    name = 'sifrovacka'
diff --git a/sifrovacka/migrations/0001_initial.py b/sifrovacka/migrations/0001_initial.py
new file mode 100644
index 0000000000000000000000000000000000000000..169825d4a5509c6edcf12faa8a3e02b8ccf7d80d
--- /dev/null
+++ b/sifrovacka/migrations/0001_initial.py
@@ -0,0 +1,37 @@
+# Generated by Django 3.2.3 on 2021-08-12 06:56
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+    initial = True
+
+    dependencies = [
+    ]
+
+    operations = [
+        migrations.CreateModel(
+            name='Sifrovacka',
+            fields=[
+                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('siftovacka_name', models.CharField(max_length=200)),
+                ('pub_date', models.DateTimeField(verbose_name='date published')),
+                ('startdate_sifrovacka', models.DateField()),
+                ('enddate_sifrovacka', models.DateField()),
+            ],
+        ),
+        migrations.CreateModel(
+            name='Stages',
+            fields=[
+                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('stage_number', models.IntegerField()),
+                ('choice_text', models.CharField(max_length=200)),
+                ('votes', models.IntegerField(default=0)),
+                ('startdate_stages', models.DateField()),
+                ('enddate_stages', models.DateField()),
+                ('sifrovacka', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sifrovacka.sifrovacka')),
+            ],
+        ),
+    ]
diff --git a/sifrovacka/migrations/0002_auto_20210812_0714.py b/sifrovacka/migrations/0002_auto_20210812_0714.py
new file mode 100644
index 0000000000000000000000000000000000000000..9c60c06ba91bf3714a15e372e7c72d651a571ddd
--- /dev/null
+++ b/sifrovacka/migrations/0002_auto_20210812_0714.py
@@ -0,0 +1,25 @@
+# Generated by Django 3.2.3 on 2021-08-12 07:14
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('sifrovacka', '0001_initial'),
+    ]
+
+    operations = [
+        migrations.RemoveField(
+            model_name='stages',
+            name='enddate_stages',
+        ),
+        migrations.RemoveField(
+            model_name='stages',
+            name='startdate_stages',
+        ),
+        migrations.RemoveField(
+            model_name='stages',
+            name='votes',
+        ),
+    ]
diff --git a/sifrovacka/migrations/0003_auto_20210812_0733.py b/sifrovacka/migrations/0003_auto_20210812_0733.py
new file mode 100644
index 0000000000000000000000000000000000000000..085127eb01215190d9209e55d3f16b1fa92ddae0
--- /dev/null
+++ b/sifrovacka/migrations/0003_auto_20210812_0733.py
@@ -0,0 +1,23 @@
+# Generated by Django 3.2.3 on 2021-08-12 07:33
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('sifrovacka', '0002_auto_20210812_0714'),
+    ]
+
+    operations = [
+        migrations.RenameField(
+            model_name='sifrovacka',
+            old_name='siftovacka_name',
+            new_name='sifrovacka_name',
+        ),
+        migrations.RenameField(
+            model_name='stages',
+            old_name='choice_text',
+            new_name='stage_name',
+        ),
+    ]
diff --git a/sifrovacka/migrations/0004_participants.py b/sifrovacka/migrations/0004_participants.py
new file mode 100644
index 0000000000000000000000000000000000000000..c971b29691161c2bbd4839d38094554053286fd1
--- /dev/null
+++ b/sifrovacka/migrations/0004_participants.py
@@ -0,0 +1,25 @@
+# Generated by Django 3.2.3 on 2021-08-12 12:09
+
+from django.conf import settings
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+        ('sifrovacka', '0003_auto_20210812_0733'),
+    ]
+
+    operations = [
+        migrations.CreateModel(
+            name='Participants',
+            fields=[
+                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('participate', models.BooleanField()),
+                ('sifrovacka', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sifrovacka.sifrovacka')),
+                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
+            ],
+        ),
+    ]
diff --git a/sifrovacka/migrations/0005_rename_participate_participants_is_active.py b/sifrovacka/migrations/0005_rename_participate_participants_is_active.py
new file mode 100644
index 0000000000000000000000000000000000000000..b8b9086760b967c8a1c768aff61e83cfa23e92a4
--- /dev/null
+++ b/sifrovacka/migrations/0005_rename_participate_participants_is_active.py
@@ -0,0 +1,18 @@
+# Generated by Django 3.2.3 on 2021-08-30 10:41
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('sifrovacka', '0004_participants'),
+    ]
+
+    operations = [
+        migrations.RenameField(
+            model_name='participants',
+            old_name='participate',
+            new_name='is_active',
+        ),
+    ]
diff --git a/sifrovacka/migrations/0006_rename_is_active_participants_inactive.py b/sifrovacka/migrations/0006_rename_is_active_participants_inactive.py
new file mode 100644
index 0000000000000000000000000000000000000000..30ea600c0f790d4aaf475a38ad29643f529e054d
--- /dev/null
+++ b/sifrovacka/migrations/0006_rename_is_active_participants_inactive.py
@@ -0,0 +1,18 @@
+# Generated by Django 3.2.3 on 2021-08-30 10:43
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('sifrovacka', '0005_rename_participate_participants_is_active'),
+    ]
+
+    operations = [
+        migrations.RenameField(
+            model_name='participants',
+            old_name='is_active',
+            new_name='Inactive',
+        ),
+    ]
diff --git a/sifrovacka/migrations/0007_alter_participants_unique_together.py b/sifrovacka/migrations/0007_alter_participants_unique_together.py
new file mode 100644
index 0000000000000000000000000000000000000000..8178257c2f89c35f4e0eeab8bc3e335d879cc5b6
--- /dev/null
+++ b/sifrovacka/migrations/0007_alter_participants_unique_together.py
@@ -0,0 +1,19 @@
+# Generated by Django 3.2.3 on 2021-08-30 10:52
+
+from django.conf import settings
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+        ('sifrovacka', '0006_rename_is_active_participants_inactive'),
+    ]
+
+    operations = [
+        migrations.AlterUniqueTogether(
+            name='participants',
+            unique_together={('user', 'sifrovacka')},
+        ),
+    ]
diff --git a/sifrovacka/migrations/0008_auto_20210831_1055.py b/sifrovacka/migrations/0008_auto_20210831_1055.py
new file mode 100644
index 0000000000000000000000000000000000000000..f21485236be6f4f6f3859aac0982dbd3bac429ad
--- /dev/null
+++ b/sifrovacka/migrations/0008_auto_20210831_1055.py
@@ -0,0 +1,22 @@
+# Generated by Django 3.2.3 on 2021-08-31 10:55
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('sifrovacka', '0007_alter_participants_unique_together'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='participants',
+            name='Inactive',
+            field=models.BooleanField(blank=True),
+        ),
+        migrations.AlterUniqueTogether(
+            name='stages',
+            unique_together={('stage_number', 'sifrovacka')},
+        ),
+    ]
diff --git a/sifrovacka/migrations/0009_alter_participants_inactive.py b/sifrovacka/migrations/0009_alter_participants_inactive.py
new file mode 100644
index 0000000000000000000000000000000000000000..aab5b018fbb83358b4a32171f8a93e7c266fbb79
--- /dev/null
+++ b/sifrovacka/migrations/0009_alter_participants_inactive.py
@@ -0,0 +1,18 @@
+# Generated by Django 3.2.3 on 2021-08-31 11:00
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('sifrovacka', '0008_auto_20210831_1055'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='participants',
+            name='Inactive',
+            field=models.BooleanField(default=False),
+        ),
+    ]
diff --git a/sifrovacka/migrations/0010_alter_sifrovacka_pub_date.py b/sifrovacka/migrations/0010_alter_sifrovacka_pub_date.py
new file mode 100644
index 0000000000000000000000000000000000000000..861feedf3baf6d956376d31aa39d58de7801c66a
--- /dev/null
+++ b/sifrovacka/migrations/0010_alter_sifrovacka_pub_date.py
@@ -0,0 +1,18 @@
+# Generated by Django 3.2.3 on 2021-08-31 18:12
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('sifrovacka', '0009_alter_participants_inactive'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='sifrovacka',
+            name='pub_date',
+            field=models.DateField(),
+        ),
+    ]
diff --git a/sifrovacka/migrations/0011_alter_sifrovacka_pub_date.py b/sifrovacka/migrations/0011_alter_sifrovacka_pub_date.py
new file mode 100644
index 0000000000000000000000000000000000000000..1148044bd6e8bdac3cda6edad7a56ec8c0ae6837
--- /dev/null
+++ b/sifrovacka/migrations/0011_alter_sifrovacka_pub_date.py
@@ -0,0 +1,18 @@
+# Generated by Django 3.2.3 on 2021-08-31 18:13
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('sifrovacka', '0010_alter_sifrovacka_pub_date'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='sifrovacka',
+            name='pub_date',
+            field=models.DateTimeField(verbose_name='date published'),
+        ),
+    ]
diff --git a/sifrovacka/migrations/__init__.py b/sifrovacka/migrations/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/sifrovacka/models.py b/sifrovacka/models.py
new file mode 100644
index 0000000000000000000000000000000000000000..6cf73731103779e0a53df9054db62b9f8e01c4eb
--- /dev/null
+++ b/sifrovacka/models.py
@@ -0,0 +1,62 @@
+from django.db import models
+
+# Create your models here.
+
+from django.conf import settings
+
+
+class Sifrovacka(models.Model):
+    '''
+    model which describes sifrovacka
+    '''
+    sifrovacka_name = models.CharField(max_length=200)
+    #pub_date = models.DateField()
+    pub_date = models.DateTimeField('date published')
+    startdate_sifrovacka = models.DateField()
+    enddate_sifrovacka = models.DateField()
+
+    def __str__(self):
+        return self.sifrovacka_name
+
+
+
+
+class Stages(models.Model):
+    '''
+    model which describes how many stages are in particular sifrovacka
+    '''
+    stage_name = models.CharField(max_length=200)
+    sifrovacka = models.ForeignKey(Sifrovacka, on_delete=models.CASCADE)
+    stage_number = models.IntegerField()
+#    if not stage_name_text models:
+#        stage_name = getattr(Stages, sifrovacka_name)
+#            "-" + getattr(Stages, stage_number))
+#    else:
+#        stage_name = stage_name_text
+#    votes = models.IntegerField(default=0)
+#    startdate_stages = models.DateField()
+#    enddate_stages= models.DateField()
+
+    def __str__(self):
+        return str(self.sifrovacka) + " - Stage " + str(self.stage_number)
+
+
+    class Meta:
+        unique_together = [['stage_number', 'sifrovacka']]
+
+
+class Participants(models.Model):
+    '''
+    table which connects sifrovacka with users who participate
+    '''
+    user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete = models.CASCADE)
+    sifrovacka = models.ForeignKey(Sifrovacka, on_delete = models.CASCADE)
+    Inactive = models.BooleanField(default = False)
+
+    def __str__(self):
+        return str(self.user) + " - " + str(self.sifrovacka)
+
+
+    class Meta:
+        unique_together = [['user', 'sifrovacka']]
+
diff --git a/sifrovacka/templates/base.html b/sifrovacka/templates/base.html
new file mode 100644
index 0000000000000000000000000000000000000000..58a9f665ff9bac18b4c20e78822b55c3a2e0d32e
--- /dev/null
+++ b/sifrovacka/templates/base.html
@@ -0,0 +1,161 @@
+{% load static %}
+<!doctype html>
+<html lang="cs">
+<head>
+  <!-- Meta -->
+  <meta charset="utf-8">
+  <meta name="viewport" content="width=device-width" />
+  {% if settings.SIFROVACKA_ENV == "test" %}
+    <meta name="robots" content="noindex, nofollow">
+  {% endif %}
+
+  <!-- Favicon -->
+  {% comment%}
+  {% include "shared/favicon_snippet.html" %}
+  {% endcomment %}
+
+  <!-- Styles -->
+  <link href="https://styleguide.pir-test.eu/2.3.x/css/styles.css" rel="stylesheet" media="all" />
+
+  <style type="text/css">
+    .head-alt-md, .head-alt-lg {
+      line-height: 1.25;
+    }
+    .content-block a {
+      color: #004958;
+    }
+    .text-white a {
+      color: #FFFFFF;
+    }
+    a.btn {
+      text-decoration: none !important;
+    }
+  </style>
+
+  {% if settings.SIFROVACKA_ENV == "prod" and settings.ONBOARDING_MATOMO_ID %}
+    {% include "shared/matomo_snippet.html" with matomo_id=settings.ONBOARDING_MATOMO_ID %}
+  {% endif %}
+
+  <title>Ĺ ifrovaÄŤky</title>
+</head>
+
+<body>
+
+  {% if settings.SIFROVACKA_ENV == "test" %}
+    <div class="bg-yellow-200 p-2 text-center flex-grow"><b>TESTOVACĂŤ VERZE!</b> &nbsp;&nbsp; Informace nemusejĂ­ odpovĂ­dat skuteÄŤnosti.</div>
+  {% endif %}
+
+  <nav class="navbar navbar--simple __js-root">
+    <div>
+      <div class="container container--wide navbar__content navbar__content--initialized">
+        <div class="navbar__brand my-4 flex items-center lg:pr-8 lg:my-0">
+          <a href="/"><img src="https://styleguide.pir-test.eu/2.3.x/images/logo-round-white.svg" class="w-8"></a>
+          <span class="pl-4 font-bold text-xl lg:border-r lg:border-grey-300 lg:pr-8">
+           <a href={% url "index"%}>Sifrovacky</a>
+            {% if settings.SIFROVACKA_ENV == "dev" %}<sup class="text-cyan-100">(DEV)</sup>{% endif %}
+          </span>
+        </div>
+        <div class="navbar__menutoggle my-4 flex justify-end lg:hidden">
+          <a href="#" class="no-underline hover:no-underline"><i class="ico--menu text-3xl"></i></a>
+        </div>
+        <div class="navbar__main navbar__section navbar__section--expandable container-padding--zero lg:container-padding--auto flex items-center">
+          <div class="flex-grow">
+            <ul class="navbar-menu text-white">
+              <li class="navbar-menu__item">
+                <!--<a href="#" data-href="#" class="navbar-menu__link">HlavnĂ­ strana</a>-->
+              </li>
+            </ul>
+          </div>
+          <div class="flex items-center space-x-4">
+            {% if user.is_authenticated %}
+			<span class="head-heavy-2xs"><a href={% url "home" %}>{{ user }}</a></span>
+{% comment %}
+{% endcomment %}
+              <form action="{% url "logout" %}" method="post">
+                {% csrf_token %}
+                <button class="text-grey-200 hover:text-white" title="Odhlásit se"><i class="ico--log-out"></i></button>
+              </form>
+            {% else %}
+{% comment %}
+{% endcomment %}
+              <a class="btn btn--grey-125 btn--hoveractive btn--to-white" href="{% url "login" %}">
+                <div class="btn__body ">přihlášení</div>
+              </a>
+              <a class="btn btn--grey-125 btn--hoveractive btn--to-white" href="{% url "django_registration_register" %}">
+                <div class="btn__body ">registrace</div>
+              </a>
+            {% endif %}
+          </div>
+        </div>
+      </div>
+    </div>
+  </nav>
+
+  {% if messages %}
+    <div class="container container--default pt-3">
+      {% for message in messages %}
+        <div class="alert alert--{{ message.level_tag }}">{{ message }}</div>
+      {% endfor %}
+    </div>
+  {% endif %}
+
+  <div class="container container--default py-8 lg:py-24">
+    <div class="content-block">
+      {% block content %}{% endblock %}
+    </div>
+  </div>
+
+  <footer class="footer bg-grey-700 text-white __js-root">
+    <ui-app inline-template>
+      <div>
+        <div class="footer__main py-4 lg:py-16 container container--default">
+          <section class="footer__brand">
+            <a href="https://www.pirati.cz">
+              <img src="https://styleguide.pir-test.eu/2.3.x/images/logo-full-white.svg" alt="logo pirátské strany" class="w-32 md:w-40 pb-6" />
+            </a>
+            <p class="para hidden md:block md:mb-4 lg:mb-0 text-grey-200">
+              <span class="copyleft inline-block">&copy;</span> {% now "Y" %} Piráti. Všechna práva vyhlazena. Sdílejte a nechte ostatní sdílet za stejných podmínek.
+            </p>
+          </section>
+          <section class="footer__social lg:text-right">
+            <div class="mb-4">
+              <div class="social-icon-group space-x-2 text-white pb-4">
+                <a href="https://www.pirati.cz" class="social-icon "><i class="ico--home"></i></a>
+                <a href="https://www.facebook.com/ceska.piratska.strana/" class="social-icon "><i class="ico--facebook"></i></a>
+                <a href="https://twitter.com/PiratskaStrana" class="social-icon "><i class="ico--twitter"></i></a>
+                <a href="https://www.youtube.com/user/CeskaPiratskaStrana" class="social-icon "><i class="ico--youtube"></i></a>
+                <a href="https://www.instagram.com/pirati.cz/" class="social-icon "><i class="ico--instagram"></i></a>
+                <a href="https://www.flickr.com/photos/pirati/" class="social-icon "><i class="ico--flickr"></i></a>
+              </div>
+            </div>
+            <div class="flex flex-col md:flex-row lg:flex-col lg:items-end space-y-2 md:space-y-0 md:space-x-2 lg:space-x-0 lg:space-y-2">
+              <a href="https://dary.pirati.cz" class="btn btn--icon btn--cyan-200 btn--hoveractive text-lg btn--fullwidth sm:btn--autowidth">
+                <div class="btn__body-wrap">
+                  <div class="btn__body ">Přispěj</div>
+                  <div class="btn__icon ">
+                    <i class="ico--pig"></i>
+                  </div>
+                </div>
+              </a>
+              <a href="https://nalodeni.pirati.cz" class="btn btn--icon btn--blue-300 btn--hoveractive text-lg btn--fullwidth sm:btn--autowidth">
+                <div class="btn__body-wrap">
+                  <div class="btn__body ">NaloÄŹ se</div>
+                  <div class="btn__icon ">
+                    <i class="ico--anchor"></i>
+                  </div>
+                </div>
+              </a>
+            </div>
+          </section>
+        </div>
+      </div>
+    </ui-app>
+  </footer>
+
+  <script src="{% static "shared/vendor/vue/vue.2.6.11.js" %}"></script>
+  <script src="https://styleguide.pir-test.eu/2.3.x/js/main.bundle.js"></script>
+  <script src="{% static "shared/vendor/jquery/jquery-3.4.1.min.js" %}"></script>
+  {% block extra_js %}{% endblock %}
+</body>
+</html>
+
diff --git a/sifrovacka/templates/django_registration/registration_base.html b/sifrovacka/templates/django_registration/registration_base.html
new file mode 100644
index 0000000000000000000000000000000000000000..32adb094f5f1f760b919033db55c43566cf49434
--- /dev/null
+++ b/sifrovacka/templates/django_registration/registration_base.html
@@ -0,0 +1,23 @@
+{% extends "base.html" %}
+
+{% comment %}
+<h2>Sign up</h2>
+ <form method="post">
+    {% csrf_token %}
+    {% for field in form %}
+      <p>
+        {{ field.label_tag }}<br>
+        {{ field }}
+        {% if field.help_text %}
+          <small style="color: grey">{{ field.help_text }}</small>
+        {% endif %}
+        {% for error in field.errors %}
+          <p style="color: red">{{ error }}</p>
+        {% endfor %}
+      </p>
+    {% endfor %}
+    <button type="submit">Sign up</button>
+  </form>
+
+{% endblock %}
+{% endcomment %}
diff --git a/sifrovacka/templates/django_registration/registration_closed.html b/sifrovacka/templates/django_registration/registration_closed.html
new file mode 100644
index 0000000000000000000000000000000000000000..ca6de6c26b2377dc4683f7f061c173e5efa46ca2
--- /dev/null
+++ b/sifrovacka/templates/django_registration/registration_closed.html
@@ -0,0 +1,8 @@
+{% extends "django_registration/registration_base.html" %}
+{% load i18n %}
+
+{% block title %}{% trans "Registration is closed" %}{% endblock %}
+
+{% block content %}
+<p>{% trans "Sorry, but registration is closed at this moment. Come back later." %}</p>
+{% endblock %}
diff --git a/sifrovacka/templates/django_registration/registration_complete.html b/sifrovacka/templates/django_registration/registration_complete.html
new file mode 100644
index 0000000000000000000000000000000000000000..6fea9882817e7bafb02f1302d37acda11f5e9baf
--- /dev/null
+++ b/sifrovacka/templates/django_registration/registration_complete.html
@@ -0,0 +1,18 @@
+{% extends "django_registration/registration_base.html" %}
+{% load i18n %}
+
+{% block title %}{% trans "Activation email sent" %}{% endblock %}
+
+{% block content %}
+<p>{% trans "Please check your email to complete the registration process." %}</p>
+{% endblock %}
+
+
+{% comment %}
+**registration/registration_complete.html**
+
+Used after successful completion of the registration form. This
+template has no context variables of its own, and should simply inform
+the user that an email containing account-activation information has
+been sent.
+{% endcomment %}
diff --git a/sifrovacka/templates/django_registration/registration_form.html b/sifrovacka/templates/django_registration/registration_form.html
new file mode 100644
index 0000000000000000000000000000000000000000..7df1faaceb8ecff0975dbdfea1e13aa6f493c3c4
--- /dev/null
+++ b/sifrovacka/templates/django_registration/registration_form.html
@@ -0,0 +1,25 @@
+{% extends "django_registration/registration_base.html" %}
+{% load i18n %}
+
+{% block title %}{% trans "Register for an account" %}{% endblock %}
+
+{% block content %}
+<form method="post" action="">
+    {% csrf_token %}
+    {{ form.as_p }}
+    <input type="submit" value="{% trans 'Submit' %}" />
+</form>
+{% endblock %}
+
+
+{% comment %}
+**registration/registration_form.html**
+Used to show the form users will fill out to register. By default, has
+the following context:
+
+``form``
+    The registration form. This will be an instance of some subclass
+    of ``django.forms.Form``; consult `Django's forms documentation
+    <http://docs.djangoproject.com/en/dev/topics/forms/>`_ for
+    information on how to display this in a template.
+{% endcomment %}
diff --git a/sifrovacka/templates/home.html b/sifrovacka/templates/home.html
new file mode 100644
index 0000000000000000000000000000000000000000..0770db61a841e9df02485adbedf62815a3cf89b8
--- /dev/null
+++ b/sifrovacka/templates/home.html
@@ -0,0 +1,35 @@
+{% extends "base.html" %}
+{% if request.user.is_authenticated %}
+ {% block content %}
+  <ul>
+   <p> <b>Dostupne sifrovacky: </b> <a href={% url 'index' %}> Zde </a></p>
+{% comment %}
+{% endcomment %}
+
+  {% if participation_sifrovacky_list %}
+   <ul>
+    <p> <b>Přihlášené sifrovacky: </b> </p>
+    {% for sifrovacka in participation_sifrovacky_list %}
+     <li><a href={% url 'detail' sifrovacka.sifrovacka_id %}>{{ sifrovacka }}</a></li>
+    {% endfor %}
+   </ul>
+  {% else %}
+   <p>Zadne sifrovacky nemate aktivnĂ­.</p>
+  {% endif %}
+ {% endblock %}
+{{% endif %}
+
+{% comment %}
+{% block content %}
+  {% if active_sifrovacky_list %}
+   <ul>
+    <p> <b>Aktivni sifrovacky: </b> </p>
+    {% for sifrovacka in active_sifrovacky_list %}
+     <li><a href={% url 'detail' sifrovacka.id %}>{{ sifrovacka.sifrovacka_name }}</a></li>
+    {% endfor %}
+   </ul>
+ {% else %}
+  <p>Žádné šifrovačky nejsou aktivní.</p>
+ {% endif %}
+ {% endblock %}
+{% endcomment %}
diff --git a/sifrovacka/templates/index.html b/sifrovacka/templates/index.html
new file mode 100644
index 0000000000000000000000000000000000000000..f33ceda666e63bdfb2d4ec726d867cdf999eede6
--- /dev/null
+++ b/sifrovacka/templates/index.html
@@ -0,0 +1,37 @@
+{% extends "base.html" %}
+
+{% block content %}
+ {% if sifrovacky_list %}
+{% comment %}
+   {% if request.user.is_authenticated %}
+    {% for sifrovacka in available_sifrovacky_list %}
+{% endcomment %}
+   <ul>
+    <p> <b>Aktivni sifrovacky: </b> </p>
+    {% for sifrovacka in sifrovacky_list %}
+     <li><a href={% url 'detail' sifrovacka.id %}>{{ sifrovacka.sifrovacka_name }}</a></li>
+    {% endfor %}
+   </ul>
+   {% if request.user.is_authenticated %}
+   <ul>
+    <p> <b>Prihlasene sifrovacky: </b> </p>
+    {% for sifrovacka in user_active_sifrovacky %}
+     <li><a href={% url 'detail' sifrovacka.sifrovacka.id %}>{{ sifrovacka }}</a></li>
+    {% endfor %}
+   </ul>
+   {% endif %}
+   <ul>
+    <p> <b>Ukoncene sifrovacky: </b> </p>
+    {% for sifrovacka in archived_sifrovacky %}
+     <li><a href={% url 'detail' sifrovacka.id %}>{{ sifrovacka.sifrovacka_name }}</a></li>
+    {% endfor %}
+   </ul>
+{% comment %}
+  {% else %}
+   <p>Zadne sifrovacky nejsou aktivni nebo se ucastnite vsech dostupnych.</p>
+  {% endif %}
+{% endcomment %}
+ {% else %}
+  <p>Je nam lito, ale zadne sifrovacky nejsou aktualne dostupne.</p>
+ {% endif %}
+{% endblock %}
diff --git a/sifrovacka/templates/registration/login.html b/sifrovacka/templates/registration/login.html
new file mode 100644
index 0000000000000000000000000000000000000000..17f6b6ff3f5f2843a020595f109f89a85ed401f8
--- /dev/null
+++ b/sifrovacka/templates/registration/login.html
@@ -0,0 +1,50 @@
+{% extends "base.html" %}
+{% comment %}
+{% extends "django_registration/registration_base.html" %}
+{% endcomment %}
+{% load i18n %}
+
+{% block title %}{% trans "Log in" %}{% endblock %}
+
+{% block content %}
+<form method="post" action="">
+    {% csrf_token %}
+    {{ form.as_p }}
+    <input type="submit" value="{% trans 'Log in' %}" />
+    <input type="hidden" name="next" value="{{ next }}" />
+</form>
+
+{% comment %}
+<p>{% trans "Forgot your password?" %} <a href="{% url 'auth_password_reset' %}">{% trans "Reset it" %}</a>.</p>
+<p>{% trans "Nemáte účet?" %} <a href="{% url 'django_registration_register' %}">{% trans "Register" %}</a>.</p>
+{% endcomment %}
+{% endblock %}
+
+
+{% comment %}
+**registration/login.html**
+
+It's your responsibility to provide the login form in a template called
+registration/login.html by default. This template gets passed four
+template context variables:
+
+``form``
+    A Form object representing the login form. See the forms
+    documentation for more on Form objects.
+
+``next``
+    The URL to redirect to after successful login. This may contain a
+    query string, too.
+
+``site``
+    The current Site, according to the SITE_ID setting. If you don't
+    have the site framework installed, this will be set to an instance
+    of RequestSite, which derives the site name and domain from the
+    current HttpRequest.
+
+``site_name``
+    An alias for site.name. If you don't have the site framework
+    installed, this will be set to the value of
+    request.META['SERVER_NAME']. For more on sites, see The
+    "sites" framework.
+{% endcomment %}
diff --git a/sifrovacka/templates/registration/logout.html b/sifrovacka/templates/registration/logout.html
new file mode 100644
index 0000000000000000000000000000000000000000..c8ea686ba0d17011a67f4db5e0258fc7dca8c576
--- /dev/null
+++ b/sifrovacka/templates/registration/logout.html
@@ -0,0 +1,8 @@
+{% extends "django_registration/registration_base.html" %}
+{% load i18n %}
+
+{% block title %}{% trans "Logged out" %}{% endblock %}
+
+{% block content %}
+<p>{% trans "Successfully logged out" %}.</p>
+{% endblock %}
diff --git a/sifrovacka/templates/registration/profile.html b/sifrovacka/templates/registration/profile.html
new file mode 100644
index 0000000000000000000000000000000000000000..77fccd9f5caccbdff920d048ffa9e530da78b89d
--- /dev/null
+++ b/sifrovacka/templates/registration/profile.html
@@ -0,0 +1,50 @@
+{% extends "base.html" %}
+{% comment %}
+{% extends "django_registration/registration_base.html" %}
+{% endcomment %}
+{% load i18n %}
+
+{% block title %}{% trans "Profile" %}{% endblock %}
+
+{% block content %}
+<form method="post" action="">
+    {% csrf_token %}
+    {{ form.as_p }}
+    <input type="submit" value="{% trans 'Log in' %}" />
+    <input type="hidden" name="next" value="{{ next }}" />
+</form>
+
+{% comment %}
+<p>{% trans "Forgot your password?" %} <a href="{% url 'auth_password_reset' %}">{% trans "Reset it" %}</a>.</p>
+<p>{% trans "Not a member?" %} <a href="{% url 'registration_register' %}">{% trans "Register" %}</a>.</p>
+{% endcomment %}
+{% endblock %}
+
+
+{% comment %}
+**registration/login.html**
+
+It's your responsibility to provide the login form in a template called
+registration/login.html by default. This template gets passed four
+template context variables:
+
+``form``
+    A Form object representing the login form. See the forms
+    documentation for more on Form objects.
+
+``next``
+    The URL to redirect to after successful login. This may contain a
+    query string, too.
+
+``site``
+    The current Site, according to the SITE_ID setting. If you don't
+    have the site framework installed, this will be set to an instance
+    of RequestSite, which derives the site name and domain from the
+    current HttpRequest.
+
+``site_name``
+    An alias for site.name. If you don't have the site framework
+    installed, this will be set to the value of
+    request.META['SERVER_NAME']. For more on sites, see The
+    "sites" framework.
+{% endcomment %}
diff --git a/sifrovacka/templates/sifrovacka.html b/sifrovacka/templates/sifrovacka.html
new file mode 100644
index 0000000000000000000000000000000000000000..bb322a6288a6c565770dbf452259e7a227249ce0
--- /dev/null
+++ b/sifrovacka/templates/sifrovacka.html
@@ -0,0 +1,41 @@
+{% extends "base.html" %}
+
+{% block content %}
+<p> Toto je detail sifrovacky se jmenem: <b>{{sifrovacka_detail}} </b> a id: {{sifrovacka_id}}. </p>
+</br>
+<p> Pocet ukolu: <b> {{ sifrovacka_stage_count }} </b> </br>
+    Obtiznost: NONE</br>
+    Casova narocnost: NONE</p>
+
+</br>
+{% if request.user.is_authenticated %}
+<form action="{% url 'home' %}" method="post">
+{% csrf_token %}
+{% comment %}
+<form action="{% url 'sifrovacka:home' sifrovacka.id %}" method="post">
+{% csrf_token %}
+<button type="submit" value=signupsif name='signupsif'>Prihlasit se k sifrovacce</button>
+<button type="submit" value=signupsif onclick="location.href='{% url 'home' %}'" name='_signupsif'>Prihlasit se k sifrovacce</button>
+<fieldset>
+    <legend><h1>{{ sifrovacka_detail }}</h1></legend>
+    {% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %}
+    {% for choice in question.choice_set.all %}
+        <input type="radio" name="signupsif" id="signupsif" value="{{ sifrovacka_id }}">
+        <label for="signupsif"> Začít šifrovačku</label><br>
+    {% endfor %}
+</fieldset>
+<input type="submit" name="signupsif" value={{ sifrovacka_id }}>
+{% endcomment %}
+<button type="submit" value={{ sifrovacka_id }} name='signupsif'>Prihlasit se k sifrovacce</button>
+</form>
+{% endif %}
+</br>
+</br>
+</br>
+Debug:
+<div>
+{% for stage in sifrovacka_stages %}
+ {{ stage }}</br>
+{% endfor %}
+</div>
+{% endblock %}
diff --git a/sifrovacka/tests.py b/sifrovacka/tests.py
new file mode 100644
index 0000000000000000000000000000000000000000..7ce503c2dd97ba78597f6ff6e4393132753573f6
--- /dev/null
+++ b/sifrovacka/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/sifrovacka/urls.py b/sifrovacka/urls.py
new file mode 100644
index 0000000000000000000000000000000000000000..fd54650f39434ed0a70751a75f7df41f516f3cdb
--- /dev/null
+++ b/sifrovacka/urls.py
@@ -0,0 +1,15 @@
+from django.urls import include,path
+
+from . import views
+
+urlpatterns = [
+    # accounts uls
+    path('accounts/', include('django_registration.backends.one_step.urls')),
+    path('accounts/', include('django.contrib.auth.urls')),
+    # the 'name' value as called by the {% url %} template tag
+    path('<int:sifrovacka_id>/', views.detail, name='detail'),
+    # home page
+    path('home/', views.home, name='home'),
+    # /
+    path('', views.index, name='index'),
+]
diff --git a/sifrovacka/views.py b/sifrovacka/views.py
new file mode 100644
index 0000000000000000000000000000000000000000..c068f42fa8a8f2244dc70b73bcaafe16199a8e57
--- /dev/null
+++ b/sifrovacka/views.py
@@ -0,0 +1,87 @@
+from django.shortcuts import render
+
+# Create your views here.
+from django.utils import timezone
+from django.http import HttpResponse
+from django.template import loader
+from django.contrib.auth import login,logout
+from .models import Sifrovacka, Stages, Participants
+
+
+def detail(request, sifrovacka_id):
+    sifrovacka_detail = Sifrovacka.objects.get(id = sifrovacka_id)
+    sifrovacka_stages = Stages.objects.filter(sifrovacka__sifrovacka_name = sifrovacka_detail)
+    sifrovacka_stage_count = sifrovacka_stages.count()
+    context = {"sifrovacka_id": sifrovacka_id,
+               "sifrovacka_detail": sifrovacka_detail,
+               "sifrovacka_stages": sifrovacka_stages,
+               "sifrovacka_stage_count": sifrovacka_stage_count}
+    return render(request, 'sifrovacka.html', context)
+
+def home(request):
+    all_sifrovacky_list = Sifrovacka.objects.order_by('id')
+    # only for auth users
+    if request.user.is_authenticated:
+        participation_sifrovacky_list = Participants.objects.filter(user =
+                                        request.user).order_by('sifrovacka_id')
+       # available_sifrovacky_list = all_sifrovacky_list.difference(
+                                    #participation_sifrovacky_list)
+        if request.method == 'POST':
+              if request.POST["signupsif"]:
+                  print(request.POST["signupsif"])
+                  p = Participants.objects.create(user_id=1, sifrovacka_id=1)
+                  p.save()
+    else:
+        participation_sifrovacky_list = None
+
+
+   # sifrovacka_name = Sifrovacka.objects.get(id = sifrovacka_id)
+
+    context = {"active_sifrovacky_list": all_sifrovacky_list,
+               "participation_sifrovacky_list": participation_sifrovacky_list}
+
+#    import pdb
+#    pdb.set_trace()
+    return render(request, 'home.html', context)
+
+def index(request):
+    if request.user.is_authenticated:
+        list_user_active_sifrovacky = Participants.objects.filter( user =
+                                      request.user).order_by('sifrovacka_id')
+        #list_user_active_sifrovacky = request.user.participants_set.values_list(
+        #                            'sifrovacka_id')
+        list_all_user_sifrovacky = request.user.participants_set.values_list(
+                                    'sifrovacka_id', flat=True)
+        print(list_user_active_sifrovacky)
+        list_available = Sifrovacka.objects.filter(
+                          startdate_sifrovacka__lte = timezone.now()).filter(
+                          enddate_sifrovacka__gte = timezone.now()).exclude(
+                          id__in=list_all_user_sifrovacky)
+        #print(list_available)
+        list_all_sifrovacky = list_available
+
+
+    else:
+        list_all_sifrovacky = Sifrovacka.objects.filter(
+                               startdate_sifrovacka__lte = timezone.now()).filter(
+                               enddate_sifrovacka__gte = timezone.now())
+        list_user_active_sifrovacky = []
+
+    list_archived_sifrovacky = Sifrovacka.objects.filter(
+                               startdate_sifrovacka__lte = timezone.now()).filter(
+                               enddate_sifrovacka__lt = timezone.now())
+
+
+
+    context = {"sifrovacky_list": list_all_sifrovacky,
+               "archived_sifrovacky": list_archived_sifrovacky,
+               "user_active_sifrovacky": list_user_active_sifrovacky,
+              }
+    #context = {"": ""}
+
+    return render(request, 'index.html', context)
+
+
+
+
+