Skip to content

Commit e63eed5

Browse files
authored
Merge pull request #563 from WebarchivCZ/master
Hotfix
2 parents fef9694 + e5f1c75 commit e63eed5

File tree

13 files changed

+91
-50
lines changed

13 files changed

+91
-50
lines changed

Jenkinsfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ pipeline {
3434
cd ci
3535
ansible-playbook -i test prepare-configuration.yml
3636
docker-compose -f docker-compose-test.yml -p seeder pull
37-
docker-compose -f docker-compose-test.yml -p seeder up -d --remove-orphans
37+
docker-compose -f docker-compose-test.yml -p seeder rm --stop --force web static
38+
docker volume rm seeder_static
39+
docker-compose -f docker-compose-test.yml -p seeder up -d
3840
'''
3941
}
4042
}
@@ -59,7 +61,9 @@ pipeline {
5961
ansible-playbook -i prod --private-key ${SSH_CREDS} -u ${SSH_CREDS_USR} prepare-configuration.yml
6062
# I had issues witch docker_compose module in ansible. Thus implmentation in ssh as workaround.
6163
ssh -o "StrictHostKeyChecking=no" -i ${SSH_CREDS} ${SSH_CREDS_USR}@10.3.0.50 docker-compose -f docker-compose-prod.yml -p seeder pull
62-
ssh -o "StrictHostKeyChecking=no" -i ${SSH_CREDS} ${SSH_CREDS_USR}@10.3.0.50 docker-compose -f docker-compose-prod.yml -p seeder up -d --remove-orphans
64+
ssh -o "StrictHostKeyChecking=no" -i ${SSH_CREDS} ${SSH_CREDS_USR}@10.3.0.50 docker-compose -f docker-compose-prod.yml -p rm --stop --force web static
65+
ssh -o "StrictHostKeyChecking=no" -i ${SSH_CREDS} ${SSH_CREDS_USR}@10.3.0.50 docker volume rm seeder_static
66+
ssh -o "StrictHostKeyChecking=no" -i ${SSH_CREDS} ${SSH_CREDS_USR}@10.3.0.50 docker-compose -f docker-compose-prod.yml -p seeder up -d
6367
'''
6468
}
6569
}

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
Seeder
2-
======
1+
# Seeder
32

43
[![Code Health](https://landscape.io/github/WebarchivCZ/Seeder/master/landscape.svg?style=flat)](https://landscape.io/github/WebarchivCZ/Seeder/master)
54
[![Build Status](https://travis-ci.org/WebArchivCZ/Seeder.svg?branch=master)](https://travis-ci.org/WebArchivCZ/Seeder)
@@ -14,7 +13,10 @@ archived and what parts should die in the shadows of unarchived wasteland.
1413

1514
Documentation is available at [Read the docs](http://seeder.readthedocs.org/en/latest/).
1615

17-
Docker compose should work out of box after cloning. Run: ```docker-compose up```.
16+
## Production like environment
17+
Docker compose should work out of box after cloning. Run: ```docker-compose up```. Docker-compose mimics production deployment. So important note is you should ```docker volume rm static``` otherwise static_root volume persists and both nginx and django will not show latest output from collectstatic. Or just run ```./local``` which will always delete nginx and django container and static is corectly deployed.
18+
19+
Check [http://localhost](http://localhost) for Seeder, and [http://localhost:8080](http://localhost:8080) for Traefik.
1820

1921
[Webarchiv.cz deployment instructions](ci/README.md)
2022

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Generated by Django 2.2.13 on 2020-12-07 16:53
2+
3+
import contracts.models
4+
from django.db import migrations, models
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('contracts', '0005_remove_contract_creative_commons'),
11+
]
12+
13+
operations = [
14+
migrations.AlterField(
15+
model_name='contract',
16+
name='year',
17+
field=models.PositiveIntegerField(default=contracts.models.this_year, verbose_name='Year'),
18+
),
19+
]

Seeder/contracts/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class Contract(BaseModel):
7777

7878
year = models.PositiveIntegerField(
7979
_('Year'),
80-
default=this_year()
80+
default=this_year
8181
)
8282

8383
contract_file = models.FileField(

Seeder/contracts/tables.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
class ContractTable(tables.Table):
1010
link = AbsoluteURLColumn(
1111
accessor='__str__',
12-
verbose_name=_('link')
12+
verbose_name=_('link'),
13+
order_by=('-year', '-contract_number'),
1314
)
1415
publisher = AbsoluteURLColumn(
1516
accessor='publisher',

Seeder/core/dashboard_data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ class WithoutAleph(SourceCard):
184184

185185
def get_queryset(self):
186186
return self.get_basic_queryset().filter(
187+
Q(aleph_id='') | Q(aleph_id=None),
187188
state=source_models.constants.STATE_RUNNING,
188-
aleph_id__exact=''
189189
)
190190

191191

@@ -222,7 +222,7 @@ def get_queryset(self):
222222
tries < source_models.constants.RANDOM_QA_MAX_TRIES
223223
):
224224
tries += 1
225-
s = qa_sources[random.randint(0, qa_sources.count()-1)]
225+
s = qa_sources[random.randint(0, qa_sources.count() - 1)]
226226
random_qa.add(s.pk)
227227
# Order these by date so that the first item is the oldest
228228
return source_models.Source.objects.filter(

Seeder/locale/cs/LC_MESSAGES/django.po

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ msgid ""
99
msgstr ""
1010
"Project-Id-Version: Seeder\n"
1111
"Report-Msgid-Bugs-To: \n"
12-
"POT-Creation-Date: 2020-11-03 08:11+0000\n"
12+
"POT-Creation-Date: 2020-12-07 17:02+0000\n"
1313
"PO-Revision-Date: 2018-04-16 13:40+0200\n"
1414
"Last-Translator: mariehaskovcova <[email protected]>, 2017\n"
1515
"Language-Team: Czech (https://www.transifex.com/webarchivecz/teams/43032/"
@@ -269,15 +269,15 @@ msgstr "Kdy chcete odeslat tuto zprávu?"
269269
msgid "link"
270270
msgstr "Odkaz"
271271

272-
#: contracts/tables.py:16
272+
#: contracts/tables.py:17
273273
msgid "publisher"
274274
msgstr "Vydavatel"
275275

276-
#: contracts/tables.py:18 qa/tables.py:10 templates/api.html:17
276+
#: contracts/tables.py:19 qa/tables.py:10 templates/api.html:17
277277
msgid "created"
278278
msgstr "Vytvořeno"
279279

280-
#: contracts/tables.py:19 qa/tables.py:11
280+
#: contracts/tables.py:20 qa/tables.py:11
281281
msgid "last_changed"
282282
msgstr "Naposledy upraveno"
283283

@@ -427,39 +427,39 @@ msgstr "Nelze smazat smlouvu s číslem"
427427
msgid "Contract deleted."
428428
msgstr "Smlouva smazána"
429429

430-
#: core/dashboard_data.py:67
430+
#: core/dashboard_data.py:68
431431
msgid "Contracts in negotiation"
432432
msgstr "Smlouvy v jednání"
433433

434-
#: core/dashboard_data.py:87
434+
#: core/dashboard_data.py:88
435435
msgid "Contracts without scheduled communication"
436436
msgstr "Smlouvy bez rozvrhnutého jednání"
437437

438-
#: core/dashboard_data.py:114
438+
#: core/dashboard_data.py:115
439439
msgid "Voting rounds you manage"
440440
msgstr "Hodnocení, která spravujete"
441441

442-
#: core/dashboard_data.py:134
442+
#: core/dashboard_data.py:135
443443
msgid "Open voting rounds"
444444
msgstr "Otevřená hodnocení"
445445

446-
#: core/dashboard_data.py:161
446+
#: core/dashboard_data.py:162
447447
msgid "Sources curating"
448448
msgstr "Zdroje, které spravujete"
449449

450-
#: core/dashboard_data.py:173
450+
#: core/dashboard_data.py:174
451451
msgid "Sources that need technical review"
452452
msgstr "Zdroje, které potřebují technický dohled"
453453

454-
#: core/dashboard_data.py:182
454+
#: core/dashboard_data.py:183
455455
msgid "Source without Aleph ID"
456456
msgstr "Zdroje ke katalogizaci"
457457

458-
#: core/dashboard_data.py:192
458+
#: core/dashboard_data.py:193
459459
msgid "Opened QAs"
460460
msgstr "Rozpracovaná kontrola kvality"
461461

462-
#: core/dashboard_data.py:205
462+
#: core/dashboard_data.py:206
463463
msgid "Sources needing QA"
464464
msgstr "Zdroje ke kontrole"
465465

@@ -1664,6 +1664,10 @@ msgstr "aktuality"
16641664
msgid "Webarchiv certificate"
16651665
msgstr "Webarchiv certificate"
16661666

1667+
#: www/templates/categories/menu.html:50
1668+
msgid "Můžete hledat i abecedně"
1669+
msgstr "Můžete hledat i abecedně"
1670+
16671671
#: www/templates/news_admin_detail.html:32
16681672
msgid "source 1 "
16691673
msgstr "první zdroj "
@@ -1816,17 +1820,17 @@ msgstr "^certifikovano/$"
18161820
msgid "^embed_url$"
18171821
msgstr "^embed$"
18181822

1819-
#: www/views.py:427
1823+
#: www/views.py:441
18201824
#, python-format
18211825
msgid "Webarchiv.cz - archivace vasich webovych stranek %(url)s"
18221826
msgstr "Webarchiv.cz - archivace Vašich webových stránek %(url)s"
18231827

1824-
#: www/views.py:431
1828+
#: www/views.py:445
18251829
#, python-format
18261830
msgid "Webarchiv.cz - archivace webovych stranek %(url)s"
18271831
msgstr "Webarchiv.cz - archivace webových stránek %(url)s"
18281832

1829-
#: www/views.py:453
1833+
#: www/views.py:467
18301834
#, python-format
18311835
msgid "New nomination %(url)s"
18321836
msgstr "Nový návrh %(url)s"

Seeder/locale/en_US/LC_MESSAGES/django.po

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: Seeder\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2020-11-03 08:11+0000\n"
11+
"POT-Creation-Date: 2020-12-07 17:02+0000\n"
1212
"PO-Revision-Date: 2017-11-07 12:38+0100\n"
1313
"Last-Translator: Visgean Skeloru <[email protected]>, 2017\n"
1414
"Language-Team: English (United States) (https://www.transifex.com/"
@@ -270,15 +270,15 @@ msgstr "When to send this message"
270270
msgid "link"
271271
msgstr "Link"
272272

273-
#: contracts/tables.py:16
273+
#: contracts/tables.py:17
274274
msgid "publisher"
275275
msgstr "Publisher"
276276

277-
#: contracts/tables.py:18 qa/tables.py:10 templates/api.html:17
277+
#: contracts/tables.py:19 qa/tables.py:10 templates/api.html:17
278278
msgid "created"
279279
msgstr "Created"
280280

281-
#: contracts/tables.py:19 qa/tables.py:11
281+
#: contracts/tables.py:20 qa/tables.py:11
282282
msgid "last_changed"
283283
msgstr "Last_changed"
284284

@@ -430,39 +430,39 @@ msgstr "Can't delete contract with number"
430430
msgid "Contract deleted."
431431
msgstr "Contract deleted."
432432

433-
#: core/dashboard_data.py:67
433+
#: core/dashboard_data.py:68
434434
msgid "Contracts in negotiation"
435435
msgstr "Contracts in negotiation"
436436

437-
#: core/dashboard_data.py:87
437+
#: core/dashboard_data.py:88
438438
msgid "Contracts without scheduled communication"
439439
msgstr "Contracts without scheduled communication"
440440

441-
#: core/dashboard_data.py:114
441+
#: core/dashboard_data.py:115
442442
msgid "Voting rounds you manage"
443443
msgstr "Voting rounds you manage"
444444

445-
#: core/dashboard_data.py:134
445+
#: core/dashboard_data.py:135
446446
msgid "Open voting rounds"
447447
msgstr "Open voting rounds"
448448

449-
#: core/dashboard_data.py:161
449+
#: core/dashboard_data.py:162
450450
msgid "Sources curating"
451451
msgstr "Sources curating"
452452

453-
#: core/dashboard_data.py:173
453+
#: core/dashboard_data.py:174
454454
msgid "Sources that need technical review"
455455
msgstr "Sources that need technical review"
456456

457-
#: core/dashboard_data.py:182
457+
#: core/dashboard_data.py:183
458458
msgid "Source without Aleph ID"
459459
msgstr "Source without Aleph ID"
460460

461-
#: core/dashboard_data.py:192
461+
#: core/dashboard_data.py:193
462462
msgid "Opened QAs"
463463
msgstr "Opened QAs"
464464

465-
#: core/dashboard_data.py:205
465+
#: core/dashboard_data.py:206
466466
msgid "Sources needing QA"
467467
msgstr "Sources needing QA"
468468

@@ -1670,6 +1670,10 @@ msgstr "news"
16701670
msgid "Webarchiv certificate"
16711671
msgstr "Webarchiv certificate"
16721672

1673+
#: www/templates/categories/menu.html:50
1674+
msgid "Můžete hledat i abecedně"
1675+
msgstr "You can also search alphabetically"
1676+
16731677
#: www/templates/news_admin_detail.html:32
16741678
msgid "source 1 "
16751679
msgstr "source 1 "
@@ -1822,17 +1826,17 @@ msgstr "^disclaimer/$"
18221826
msgid "^embed_url$"
18231827
msgstr "^embed$"
18241828

1825-
#: www/views.py:427
1829+
#: www/views.py:441
18261830
#, python-format
18271831
msgid "Webarchiv.cz - archivace vasich webovych stranek %(url)s"
18281832
msgstr "Webarchiv.cz - web archiving your pages %(url)s"
18291833

1830-
#: www/views.py:431
1834+
#: www/views.py:445
18311835
#, python-format
18321836
msgid "Webarchiv.cz - archivace webovych stranek %(url)s"
18331837
msgstr "Webarchiv.cz - web archiving %(url)s"
18341838

1835-
#: www/views.py:453
1839+
#: www/views.py:467
18361840
#, python-format
18371841
msgid "New nomination %(url)s"
18381842
msgstr "New nomination %(url)s"

Seeder/source/field_filters.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import django_filters
2-
2+
from django.db.models import Q
33
from django.utils.translation import ugettext_lazy as _
44
from dal import autocomplete
55
from core.custom_filters import BaseFilterSet, DateRangeFilter
@@ -15,18 +15,20 @@ def filter_not_empty(queryset, name, value):
1515
return q.exclude(**{lookup_empty: ''})
1616
else:
1717
empty = queryset.filter(
18-
aleph_id__exact='').values_list('pk', flat=True)
18+
Q(aleph_id='') | Q(aleph_id=None)).values_list('pk', flat=True)
1919
null = q.values_list('pk', flat=True)
2020
return queryset.filter(pk__in=list(empty) + list(null))
2121

2222

2323
def filter_has_cc(queryset, name, value):
2424
return models.Source.objects.has_cc(value)
2525

26+
2627
def filter_contract_number(queryset, name, value):
2728
# value in format e.g. '64 / 2017'
2829
return models.Source.objects.contains_contract_number(value)
2930

31+
3032
class SourceFilter(BaseFilterSet):
3133
publisher = django_filters.ModelChoiceFilter(
3234
queryset=Publisher.objects.all(),

Seeder/www/templates/categories/menu.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{% load i18n %}
12
{% load urltags %}
23
<section id="catalog-header">
34
<div class="container">
@@ -46,7 +47,7 @@ <h2 class="italic">{{ current_category }} / {{ current_sub_category }}</h2>
4647
{% endfor %}
4748
</ul>
4849
{% else %}
49-
<h2 class="italic">Můžete hledat i abecedně</h2>
50+
<h2 class="italic">{% trans "Můžete hledat i abecedně" %}</h2>
5051
<ul class="inline-list subcategories">
5152
<li>
5253
<a href="{% url "www:categories" %}" {% if not current_sub_category %}class="current"

0 commit comments

Comments
 (0)