Merge branch 'master' into stable
code reviewed by xlfd
This commit is contained in:
commit
deb8fcc91a
2 changed files with 47 additions and 4 deletions
28
Makefile
28
Makefile
|
@ -1,4 +1,4 @@
|
|||
.PHONY: clean_env init_env clean_virtualenv install_packages clean install run all schema_seminar.pdf schema_all.pdf
|
||||
.PHONY: clean_env init_env clean_virtualenv install_packages clean install run all schema_seminar.pdf schema_all.pdf sync_test_media sync_test_db sync_test sync_local_media sync_local_db sync_local
|
||||
PYTHON=python2.7
|
||||
VE_VER=13.1.2
|
||||
LOCAL_PYTHON=bin/python
|
||||
|
@ -93,16 +93,36 @@ deploy_prod:
|
|||
touch mamweb/wsgi.py
|
||||
@echo Done.
|
||||
|
||||
|
||||
# Sync test media directory with production
|
||||
sync_test_media:
|
||||
@if [ ${USER} != "www-mam" ]; then echo "Only possible by user www-mam"; exit 1; fi
|
||||
@if [ `pwd` != "/akce/MaM/WWW/mamweb-test" ]; then echo "Only possible in /akce/MaM/WWW/mamweb-test"; exit 1; fi
|
||||
rsync -av /akce/MaM/WWW/mamweb-prod/media/ ./media
|
||||
|
||||
# Sync test database with production database
|
||||
sync_test_db:
|
||||
@if [ ${USER} != "www-mam" ]; then echo "Only possible by user www-mam"; exit 1; fi
|
||||
pg_dump mam-test -U mam > dump-test-`date +"%Y%m%d_%H%M"`.sql
|
||||
pg_dump -Fc mam-prod -U mam > dump-prod.sql
|
||||
pg_restore -c -d mam-test -U mam dump-prod.sql
|
||||
rm dump-prod.sql
|
||||
@echo Done.
|
||||
|
||||
# Sync test with production
|
||||
sync_test: sync_test_media sync_test_db
|
||||
|
||||
|
||||
# Sync media directory with atrey. Useful for local development with production database
|
||||
# Does not sync Galerie and CACHE (too huge).
|
||||
sync_media:
|
||||
sync_local_media:
|
||||
rsync -ave ssh --exclude Galerie --exclude CACHE\
|
||||
atrey.karlin.mff.cuni.cz:/akce/MaM/WWW/mamweb-prod/media/ ./media/
|
||||
# Downloads and restores production database to local database. PostgreSQL only.
|
||||
sync_db:
|
||||
sync_local_db:
|
||||
scp atrey.karlin.mff.cuni.cz:`ssh atrey.karlin.mff.cuni.cz 'ls -v /akce/MaM/WWW/backups/mam-prod-*\.pgdump | tail -n 1'` \
|
||||
./last.pgdump
|
||||
pg_restore -c -d mam -U mam last.pgdump
|
||||
|
||||
# Sync database and media. See above lines
|
||||
sync: sync_media sync_db
|
||||
sync_local: sync_media sync_db
|
||||
|
|
|
@ -77,6 +77,7 @@ class ResitelInline(admin.TabularInline):
|
|||
fields = ['jmeno', 'prijmeni', 'skola', 'mesto', 'rok_maturity', ]
|
||||
readonly_fields = ['jmeno', 'prijmeni', 'skola', 'mesto', 'rok_maturity', ]
|
||||
extra = 0
|
||||
view_on_site = False
|
||||
|
||||
def has_add_permission(self, req): return False
|
||||
|
||||
|
@ -89,6 +90,7 @@ class CisloInline(admin.TabularInline):
|
|||
formfield_overrides = {
|
||||
models.TextField: {'widget': forms.TextInput},
|
||||
}
|
||||
view_on_site = Cislo.verejne_url
|
||||
|
||||
def has_add_permission(self, req): return False
|
||||
|
||||
|
@ -100,9 +102,23 @@ class PrilohaReseniInline(admin.StackedInline):
|
|||
formfield_overrides = {
|
||||
models.TextField: {'widget': forms.TextInput},
|
||||
}
|
||||
view_on_site = False
|
||||
|
||||
extra = 0
|
||||
|
||||
|
||||
class ProblemInline(admin.TabularInline):
|
||||
model = Problem
|
||||
fk_name = 'cislo_zadani'
|
||||
fields = ['kod', 'typ', 'nazev', 'body', 'opravovatel', 'stav']
|
||||
formfield_overrides = {
|
||||
models.TextField: {'widget': forms.TextInput},
|
||||
}
|
||||
view_on_site = Problem.verejne_url
|
||||
|
||||
extra = 0
|
||||
|
||||
|
||||
class ReseniKProblemuInline(admin.TabularInline):
|
||||
form = autocomplete_light.modelform_factory(Reseni, autocomplete_fields=['resitel'], fields=['resitel'])
|
||||
model = Reseni
|
||||
|
@ -112,6 +128,7 @@ class ReseniKProblemuInline(admin.TabularInline):
|
|||
formfield_overrides = {
|
||||
models.TextField: {'widget': forms.TextInput},
|
||||
}
|
||||
view_on_site = False
|
||||
|
||||
def get_queryset(self, request):
|
||||
qs = super(ReseniKProblemuInline, self).get_queryset(request)
|
||||
|
@ -134,6 +151,7 @@ class ReseniKResiteliInline(admin.TabularInline):
|
|||
formfield_overrides = {
|
||||
models.TextField: {'widget': forms.TextInput},
|
||||
}
|
||||
view_on_site = False
|
||||
|
||||
def has_add_permission(self, req): return False
|
||||
|
||||
|
@ -191,6 +209,7 @@ class ResitelAdmin(VersionAdmin):
|
|||
list_filter = ['pohlavi_muz', 'rok_maturity', 'zasilat']
|
||||
search_fields = ['jmeno', 'prijmeni', 'ulice', 'mesto', 'email']
|
||||
inlines = [ReseniKResiteliInline]
|
||||
view_on_site = False
|
||||
|
||||
def get_queryset(self, request):
|
||||
qs = super(ResitelAdmin, self).get_queryset(request)
|
||||
|
@ -216,6 +235,7 @@ class SkolaAdmin(VersionAdmin):
|
|||
list_filter = ['stat', 'je_zs', 'je_ss']
|
||||
search_fields = ['nazev', 'mesto', 'ulice']
|
||||
inlines = [ResitelInline]
|
||||
view_on_site = False
|
||||
|
||||
admin.site.register(Skola, SkolaAdmin)
|
||||
|
||||
|
@ -236,6 +256,7 @@ class CisloAdmin(VersionAdmin):
|
|||
make_set_action('verejna_vysledkovka', True, u'Zveřejnit výsledkovku'),
|
||||
make_set_action('verejna_vysledkovka', False, u'Skrýt (zneveřejnit) výsledkovku'),
|
||||
]
|
||||
inlines = [ProblemInline]
|
||||
|
||||
def get_queryset(self, request):
|
||||
qs = super(CisloAdmin, self).get_queryset(request)
|
||||
|
@ -288,6 +309,7 @@ class ReseniAdmin(VersionAdmin):
|
|||
list_filter = ['body', 'timestamp', 'forma']
|
||||
search_fields = []
|
||||
inlines = [PrilohaReseniInline]
|
||||
view_on_site = False
|
||||
|
||||
def get_queryset(self, request):
|
||||
qs = super(ReseniAdmin, self).get_queryset(request)
|
||||
|
@ -307,6 +329,7 @@ class PohadkaAdminForm(forms.ModelForm):
|
|||
|
||||
class PohadkaAdmin(VersionAdmin):
|
||||
form = PohadkaAdminForm
|
||||
view_on_site = False
|
||||
|
||||
def get_kod_ulohy(self, obj):
|
||||
return obj.uloha.kod_v_rocniku()
|
||||
|
|
Loading…
Reference in a new issue