Remove feincms, revert some experiments
This commit is contained in:
parent
f6fde3aaa6
commit
8262864be9
6 changed files with 182 additions and 195 deletions
|
@ -1,169 +1,2 @@
|
||||||
"""
|
from .settings_common import *
|
||||||
Django settings for mamweb project.
|
|
||||||
|
|
||||||
For more information on this file, see
|
|
||||||
https://docs.djangoproject.com/en/1.7/topics/settings/
|
|
||||||
|
|
||||||
For the full list of settings and their values, see
|
|
||||||
https://docs.djangoproject.com/en/1.7/ref/settings/
|
|
||||||
"""
|
|
||||||
|
|
||||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
|
||||||
import os
|
|
||||||
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
|
|
||||||
|
|
||||||
|
|
||||||
# Quick-start development settings - unsuitable for production
|
|
||||||
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
|
|
||||||
|
|
||||||
# SECURITY WARNING: keep the secret key used in production secret!
|
|
||||||
SECRET_KEY = ')^u=i65*zmr_k53a*@f4q_+ji^o@!pgpef*5&8c7zzv9l+zo)n'
|
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
|
||||||
DEBUG = True
|
|
||||||
|
|
||||||
TEMPLATE_DEBUG = True
|
|
||||||
|
|
||||||
ALLOWED_HOSTS = []
|
|
||||||
|
|
||||||
|
|
||||||
AUTHENTICATION_BACKENDS = (
|
|
||||||
# Needed to login by username in Django admin, regardless of `allauth`
|
|
||||||
'django.contrib.auth.backends.ModelBackend',
|
|
||||||
# `allauth` specific authentication methods, such as login by e-mail
|
|
||||||
'allauth.account.auth_backends.AuthenticationBackend',
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Application definition
|
|
||||||
|
|
||||||
SITE_ID = 1
|
|
||||||
|
|
||||||
ROOT_URLCONF = 'mamweb.urls'
|
|
||||||
|
|
||||||
WSGI_APPLICATION = 'mamweb.wsgi.application'
|
|
||||||
|
|
||||||
|
|
||||||
# Internationalization
|
|
||||||
# https://docs.djangoproject.com/en/1.7/topics/i18n/
|
|
||||||
|
|
||||||
LANGUAGE_CODE = 'cs'
|
|
||||||
|
|
||||||
TIME_ZONE = 'Europe/Prague'
|
|
||||||
|
|
||||||
USE_I18N = False
|
|
||||||
|
|
||||||
USE_L10N = True
|
|
||||||
|
|
||||||
USE_TZ = True
|
|
||||||
|
|
||||||
|
|
||||||
# Static files (CSS, JavaScript, Images)
|
|
||||||
# https://docs.djangoproject.com/en/1.7/howto/static-files/
|
|
||||||
|
|
||||||
STATIC_URL = '/static/'
|
|
||||||
MEDIA_URL = '/media/'
|
|
||||||
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
|
||||||
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
|
|
||||||
|
|
||||||
STATICFILES_DIRS = (
|
|
||||||
os.path.join(BASE_DIR, 'mamweb', 'static'),
|
|
||||||
)
|
|
||||||
|
|
||||||
STATICFILES_FINDERS = (
|
|
||||||
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
|
||||||
'django.contrib.staticfiles.finders.FileSystemFinder',
|
|
||||||
)
|
|
||||||
|
|
||||||
TEMPLATE_LOADERS = (
|
|
||||||
'django.template.loaders.filesystem.Loader',
|
|
||||||
'django.template.loaders.app_directories.Loader',
|
|
||||||
'django.template.loaders.eggs.Loader'
|
|
||||||
)
|
|
||||||
|
|
||||||
MIDDLEWARE_CLASSES = (
|
|
||||||
'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',
|
|
||||||
)
|
|
||||||
|
|
||||||
TEMPLATE_CONTEXT_PROCESSORS = (
|
|
||||||
'django.contrib.auth.context_processors.auth',
|
|
||||||
'django.contrib.messages.context_processors.messages',
|
|
||||||
'django.core.context_processors.i18n',
|
|
||||||
'django.core.context_processors.debug',
|
|
||||||
'django.core.context_processors.request',
|
|
||||||
'django.core.context_processors.media',
|
|
||||||
'django.core.context_processors.csrf',
|
|
||||||
'django.core.context_processors.tz',
|
|
||||||
'sekizai.context_processors.sekizai',
|
|
||||||
'django.core.context_processors.static',
|
|
||||||
'allauth.account.context_processors.account',
|
|
||||||
'allauth.socialaccount.context_processors.socialaccount',
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
INSTALLED_APPS = (
|
|
||||||
'django.contrib.admin',
|
|
||||||
'django.contrib.auth',
|
|
||||||
'django.contrib.contenttypes',
|
|
||||||
'django.contrib.sessions',
|
|
||||||
'django.contrib.messages',
|
|
||||||
'django.contrib.sites',
|
|
||||||
'django.contrib.staticfiles',
|
|
||||||
|
|
||||||
'sekizai',
|
|
||||||
'reversion',
|
|
||||||
'feincms',
|
|
||||||
|
|
||||||
'allauth',
|
|
||||||
'allauth.account',
|
|
||||||
'allauth.socialaccount',
|
|
||||||
# 'allauth.socialaccount.providers.facebook',
|
|
||||||
# 'allauth.socialaccount.providers.openid',
|
|
||||||
'allauth.socialaccount.providers.google',
|
|
||||||
|
|
||||||
'mamweb',
|
|
||||||
'seminar',
|
|
||||||
)
|
|
||||||
|
|
||||||
# Database
|
|
||||||
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
|
|
||||||
|
|
||||||
DATABASES = {
|
|
||||||
'default': {
|
|
||||||
# 'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
|
||||||
# 'NAME': 'mam',
|
|
||||||
# 'USER': 'mam',
|
|
||||||
# },
|
|
||||||
# 'test': {
|
|
||||||
'ENGINE': 'django.db.backends.sqlite3',
|
|
||||||
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
SOCIALACCOUNT_QUERY_EMAIL = True
|
|
||||||
SOCIALACCOUNT_PROVIDERS = {
|
|
||||||
'google': {
|
|
||||||
'SCOPE': ['profile', 'email'],
|
|
||||||
'AUTH_PARAMS': { 'access_type': 'online' }
|
|
||||||
},
|
|
||||||
'facebook': {
|
|
||||||
'SCOPE': ['email', 'publish_stream'],
|
|
||||||
'METHOD': 'js_sdk',
|
|
||||||
'VERIFIED_EMAIL': True,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ACCOUNT_AUTHENTICATION_METHOD = 'username_email'
|
|
||||||
ACCOUNT_EMAIL_REQUIRED = True
|
|
||||||
SOCIALACCOUNT_EMAIL_REQUIRED = True
|
|
||||||
|
|
||||||
# MaM specific
|
|
||||||
|
|
||||||
SEMINAR_RESENI_DIRNAME = 'reseni'
|
|
||||||
|
|
171
mamweb/settings_common.py
Normal file
171
mamweb/settings_common.py
Normal file
|
@ -0,0 +1,171 @@
|
||||||
|
"""
|
||||||
|
Django settings for mamweb project.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/1.7/topics/settings/
|
||||||
|
|
||||||
|
For the full list of settings and their values, see
|
||||||
|
https://docs.djangoproject.com/en/1.7/ref/settings/
|
||||||
|
"""
|
||||||
|
|
||||||
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||||
|
import os
|
||||||
|
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
|
||||||
|
|
||||||
|
|
||||||
|
# Quick-start development settings - unsuitable for production
|
||||||
|
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
|
||||||
|
|
||||||
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
|
SECRET_KEY = ')^u=i65*zmr_k53a*@f4q_+ji^o@!pgpef*5&8c7zzv9l+zo)n'
|
||||||
|
|
||||||
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
|
DEBUG = True
|
||||||
|
|
||||||
|
TEMPLATE_DEBUG = True
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = []
|
||||||
|
|
||||||
|
|
||||||
|
AUTHENTICATION_BACKENDS = (
|
||||||
|
# Needed to login by username in Django admin, regardless of `allauth`
|
||||||
|
'django.contrib.auth.backends.ModelBackend',
|
||||||
|
# `allauth` specific authentication methods, such as login by e-mail
|
||||||
|
'allauth.account.auth_backends.AuthenticationBackend',
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Application definition
|
||||||
|
|
||||||
|
SITE_ID = 1
|
||||||
|
|
||||||
|
ROOT_URLCONF = 'mamweb.urls'
|
||||||
|
|
||||||
|
WSGI_APPLICATION = 'mamweb.wsgi.application'
|
||||||
|
|
||||||
|
|
||||||
|
# Internationalization
|
||||||
|
# https://docs.djangoproject.com/en/1.7/topics/i18n/
|
||||||
|
|
||||||
|
LANGUAGE_CODE = 'cs'
|
||||||
|
|
||||||
|
TIME_ZONE = 'Europe/Prague'
|
||||||
|
|
||||||
|
USE_I18N = False
|
||||||
|
|
||||||
|
USE_L10N = True
|
||||||
|
|
||||||
|
USE_TZ = True
|
||||||
|
|
||||||
|
|
||||||
|
# Static files (CSS, JavaScript, Images)
|
||||||
|
# https://docs.djangoproject.com/en/1.7/howto/static-files/
|
||||||
|
|
||||||
|
STATIC_URL = '/static/'
|
||||||
|
MEDIA_URL = '/media/'
|
||||||
|
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
||||||
|
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
|
||||||
|
|
||||||
|
STATICFILES_DIRS = (
|
||||||
|
os.path.join(BASE_DIR, 'mamweb', 'static'),
|
||||||
|
)
|
||||||
|
|
||||||
|
STATICFILES_FINDERS = (
|
||||||
|
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
||||||
|
'django.contrib.staticfiles.finders.FileSystemFinder',
|
||||||
|
)
|
||||||
|
|
||||||
|
TEMPLATE_LOADERS = (
|
||||||
|
'django.template.loaders.filesystem.Loader',
|
||||||
|
'django.template.loaders.app_directories.Loader',
|
||||||
|
'django.template.loaders.eggs.Loader'
|
||||||
|
)
|
||||||
|
|
||||||
|
MIDDLEWARE_CLASSES = (
|
||||||
|
'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',
|
||||||
|
)
|
||||||
|
|
||||||
|
TEMPLATE_CONTEXT_PROCESSORS = (
|
||||||
|
'django.contrib.auth.context_processors.auth',
|
||||||
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
'django.core.context_processors.i18n',
|
||||||
|
'django.core.context_processors.debug',
|
||||||
|
'django.core.context_processors.request',
|
||||||
|
'django.core.context_processors.media',
|
||||||
|
'django.core.context_processors.csrf',
|
||||||
|
'django.core.context_processors.tz',
|
||||||
|
'sekizai.context_processors.sekizai',
|
||||||
|
'django.core.context_processors.static',
|
||||||
|
'allauth.account.context_processors.account',
|
||||||
|
'allauth.socialaccount.context_processors.socialaccount',
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
INSTALLED_APPS = (
|
||||||
|
'django.contrib.admin',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.sites',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
|
||||||
|
'sekizai',
|
||||||
|
'reversion',
|
||||||
|
|
||||||
|
'allauth',
|
||||||
|
'allauth.account',
|
||||||
|
'allauth.socialaccount',
|
||||||
|
# 'allauth.socialaccount.providers.facebook',
|
||||||
|
# 'allauth.socialaccount.providers.openid',
|
||||||
|
'allauth.socialaccount.providers.google',
|
||||||
|
|
||||||
|
|
||||||
|
'mamweb',
|
||||||
|
'seminar',
|
||||||
|
)
|
||||||
|
|
||||||
|
# Database
|
||||||
|
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
# 'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||||
|
# 'NAME': 'mam',
|
||||||
|
# 'USER': 'mam',
|
||||||
|
# },
|
||||||
|
# 'test': {
|
||||||
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
|
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SOCIALACCOUNT_QUERY_EMAIL = True
|
||||||
|
SOCIALACCOUNT_PROVIDERS = {
|
||||||
|
'google': {
|
||||||
|
'SCOPE': ['profile', 'email'],
|
||||||
|
'AUTH_PARAMS': { 'access_type': 'online' }
|
||||||
|
},
|
||||||
|
'facebook': {
|
||||||
|
'SCOPE': ['email', 'publish_stream'],
|
||||||
|
'METHOD': 'js_sdk',
|
||||||
|
'VERIFIED_EMAIL': True,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ACCOUNT_AUTHENTICATION_METHOD = 'username_email'
|
||||||
|
ACCOUNT_EMAIL_REQUIRED = True
|
||||||
|
SOCIALACCOUNT_EMAIL_REQUIRED = True
|
||||||
|
|
||||||
|
# MaM specific
|
||||||
|
|
||||||
|
SEMINAR_RESENI_DIRNAME = 'reseni'
|
||||||
|
|
||||||
|
|
2
mamweb/settings_prod.py
Normal file
2
mamweb/settings_prod.py
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
from .settings import *
|
||||||
|
|
2
mamweb/settings_test.py
Normal file
2
mamweb/settings_test.py
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
from .settings import *
|
||||||
|
|
|
@ -101,18 +101,17 @@ class ReseniInline(admin.StackedInline):
|
||||||
|
|
||||||
|
|
||||||
### Problem
|
### Problem
|
||||||
from feincms.admin import item_editor
|
|
||||||
|
|
||||||
class ProblemAdmin(item_editor.ItemEditor):
|
class ProblemAdmin(admin.ModelAdmin):
|
||||||
# readonly_fields = ['autor']
|
# readonly_fields = ['autor']
|
||||||
fieldsets = [
|
fieldsets = [
|
||||||
(None, {'fields': ['nazev', 'typ', 'stav', 'autor']}),
|
(None, {'fields': ['nazev', 'typ', 'stav', 'autor']}),
|
||||||
(u'Vydání', {'fields': ['cislo_zadani', 'kod', 'cislo_reseni', 'opravovatel']}),
|
(u'Vydání', {'fields': ['cislo_zadani', 'kod', 'cislo_reseni', 'opravovatel']}),
|
||||||
item_editor.FEINCMS_CONTENT_FIELDSET,
|
(u'Texty', {'fields': ['text_problemu', 'text_problemu_org']}),
|
||||||
]
|
]
|
||||||
list_display = ['nazev', 'typ', 'stav', 'autor', 'kod', 'opravovatel']
|
list_display = ['nazev', 'typ', 'stav', 'autor', 'kod', 'opravovatel']
|
||||||
list_filter = ['typ', 'stav', 'autor', 'opravovatel']
|
list_filter = ['typ', 'stav', 'autor', 'opravovatel']
|
||||||
search_fields = ['nazev', 'autor', 'kod']#, 'text_problemu_org', 'text_problemu']
|
search_fields = ['nazev', 'autor', 'kod', 'text_problemu_org', 'text_problemu']
|
||||||
inlines = [ReseniInline]
|
inlines = [ReseniInline]
|
||||||
|
|
||||||
admin.site.register(Problem, ProblemAdmin)
|
admin.site.register(Problem, ProblemAdmin)
|
||||||
|
|
|
@ -10,8 +10,6 @@ from django.conf import settings
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
from django.utils.encoding import python_2_unicode_compatible
|
||||||
from django.utils.encoding import force_unicode
|
from django.utils.encoding import force_unicode
|
||||||
|
|
||||||
from feincms.models import Base
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Mělo by být částečně vytaženo z Aesopa
|
# Mělo by být částečně vytaženo z Aesopa
|
||||||
# viz https://ovvp.mff.cuni.cz/wiki/aesop/export-skol.
|
# viz https://ovvp.mff.cuni.cz/wiki/aesop/export-skol.
|
||||||
|
@ -185,7 +183,7 @@ class Cislo(models.Model):
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
class Problem(Base):
|
class Problem(models.Model):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
db_table = 'seminar_problemy'
|
db_table = 'seminar_problemy'
|
||||||
|
@ -222,11 +220,9 @@ class Problem(Base):
|
||||||
]
|
]
|
||||||
stav = models.CharField(u'stav problému', max_length=32, choices=STAV_CHOICES, blank=False, default=STAV_NAVRH)
|
stav = models.CharField(u'stav problému', max_length=32, choices=STAV_CHOICES, blank=False, default=STAV_NAVRH)
|
||||||
|
|
||||||
# text_problemu_org = PlaceholderField('text_problemu_org', related_name='problem_text_org',
|
text_problemu_org = models.TextField(u'organizátorský (neveřejný) text', blank=True)
|
||||||
# verbose_name=u'organizátorský (neveřejný) text')
|
|
||||||
|
|
||||||
# text_problemu = PlaceholderField('text_problemu', related_name='problem_text',
|
text_problemu = models.TextField(u'veřejný text zadání a řešení', blank=True)
|
||||||
# verbose_name=u'veřejný text zadání a řešení')
|
|
||||||
|
|
||||||
autor = models.ForeignKey(settings.AUTH_USER_MODEL, verbose_name=u'autor problému', related_name='autor_uloh')
|
autor = models.ForeignKey(settings.AUTH_USER_MODEL, verbose_name=u'autor problému', related_name='autor_uloh')
|
||||||
|
|
||||||
|
@ -244,22 +240,6 @@ class Problem(Base):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return force_unicode(u'%s (%s)' % (self.nazev, self.stav))
|
return force_unicode(u'%s (%s)' % (self.nazev, self.stav))
|
||||||
|
|
||||||
from feincms.content.richtext.models import RichTextContent
|
|
||||||
from feincms.content.image.models import ImageContent
|
|
||||||
from feincms.content.medialibrary.models import MediaFileContent
|
|
||||||
|
|
||||||
Problem.register_regions(
|
|
||||||
('text_problemu', 'uveřejný text zadání a řešení'),
|
|
||||||
('text_problemu_org', u'organizátorský (neveřejný) text')
|
|
||||||
)
|
|
||||||
Problem.create_content_type(RichTextContent)
|
|
||||||
Problem.create_content_type(
|
|
||||||
ImageContent,
|
|
||||||
POSITION_CHOICES=(
|
|
||||||
('default', 'Default position'),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
class Reseni(models.Model):
|
class Reseni(models.Model):
|
||||||
|
|
Loading…
Reference in a new issue