From 5c260b3fe6a344964ba0b8746b2ac4f500e9d3f7 Mon Sep 17 00:00:00 2001 From: Fasand Date: Fri, 30 Aug 2024 11:25:30 +0200 Subject: [PATCH 1/8] #649: replace json_constants with django-solo, rewrite all occurrences and add translations --- Seeder/core/admin.py | 6 ++ Seeder/core/forms.py | 29 ++------ Seeder/core/json_constants.py | 85 ---------------------- Seeder/core/migrations/0001_initial.py | 28 +++++++ Seeder/core/migrations/__init__.py | 0 Seeder/core/models.py | 27 ++++++- Seeder/core/templatetags/core.py | 9 +++ Seeder/core/templatetags/json_constants.py | 12 --- Seeder/core/urls.py | 4 +- Seeder/core/views.py | 30 ++++---- Seeder/locale/cs/LC_MESSAGES/django.po | 77 ++++++++++---------- Seeder/locale/en_US/LC_MESSAGES/django.po | 77 ++++++++++---------- Seeder/settings/base.py | 4 +- Seeder/templates/base.html | 8 +- Seeder/www/forms.py | 4 +- Seeder/www/templates/base_www.html | 8 +- Seeder/www/templates/index.html | 7 +- requirements.txt | 1 + 18 files changed, 186 insertions(+), 230 deletions(-) create mode 100644 Seeder/core/admin.py delete mode 100644 Seeder/core/json_constants.py create mode 100644 Seeder/core/migrations/0001_initial.py create mode 100644 Seeder/core/migrations/__init__.py delete mode 100644 Seeder/core/templatetags/json_constants.py diff --git a/Seeder/core/admin.py b/Seeder/core/admin.py new file mode 100644 index 00000000..4db0999e --- /dev/null +++ b/Seeder/core/admin.py @@ -0,0 +1,6 @@ +from django.contrib import admin +from solo.admin import SingletonModelAdmin +from core.models import SiteConfiguration + + +admin.site.register(SiteConfiguration, SingletonModelAdmin) \ No newline at end of file diff --git a/Seeder/core/forms.py b/Seeder/core/forms.py index c5f443a5..8062b303 100644 --- a/Seeder/core/forms.py +++ b/Seeder/core/forms.py @@ -1,9 +1,8 @@ from django import forms from django.contrib.auth.models import User from django.utils.translation import ugettext_lazy as _ -from ckeditor.widgets import CKEditorWidget -from .json_constants import FieldType, load_constants, get_type_for_key +from . import models class UserForm(forms.ModelForm): @@ -27,25 +26,7 @@ def save(self, commit=True): return self.instance.delete() return super().save() - -class UpdateJsonConstantsForm(forms.Form): - - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - # Dynamically create a field for each available constant - for key, value in load_constants().items(): - field_type = get_type_for_key(key) - if field_type == FieldType.BOOL: - self.fields[key] = forms.BooleanField( - label=key, initial=value, required=False) - elif field_type == FieldType.LONG: - self.fields[key] = forms.CharField( - label=key, initial=value, required=True, - widget=forms.Textarea()) - elif field_type == FieldType.RICH: - self.fields[key] = forms.CharField( - label=key, initial=value, required=True, - widget=CKEditorWidget(config_name="json_constants")) - else: # SHORT - self.fields[key] = forms.CharField( - max_length=128, required=True, label=key, initial=value) +class SiteConfigurationForm(forms.ModelForm): + class Meta: + model = models.SiteConfiguration + fields = "__all__" diff --git a/Seeder/core/json_constants.py b/Seeder/core/json_constants.py deleted file mode 100644 index 1403e51b..00000000 --- a/Seeder/core/json_constants.py +++ /dev/null @@ -1,85 +0,0 @@ -import json -import os -from django.conf import settings - - -CONSTANTS_PATH = os.path.join(settings.BASE_DIR, "settings", "constants.json") - -TYPE_BOOL = "bool" -TYPE_SHORT = "short" -TYPE_LONG = "long" - - -class FieldType: - BOOL = "bool" # BooleanField - SHORT = "short" # CharField - LONG = "long" # TextField - RICH = "rich" # TextField using CKEditor - - -""" Constant field definition with defaults """ -FIELDS = { - "webarchive_size": { - "type": FieldType.SHORT, - "default": "409 TB", - }, - "wayback_maintenance": { - "type": FieldType.BOOL, - "default": False, - }, - "wayback_maintenance_text_cs": { - "type": FieldType.RICH, - "default": """ -

Pokud vidíte tuto stránku, probíhá údržba dat a v archivu nelze nyní vyhledávat. Některé linky vrátí chybu.

-

Prosím zkuste načíst Webarchiv později.

-""", - }, - "wayback_maintenance_text_en": { - "type": FieldType.RICH, - "default": """ -

If you see this page, we are currently doing maintenance and it is not possible to search the archive. Some links may return an error.

-

Please, try to load Webarchiv again later.

-""" - } -} - - -def get_defaults(): - """ Retrieve only field key and default value, not the type """ - return {key: field["default"] for key, field in FIELDS.items()} - - -def get_type_for_key(key): - """ Retrieve field's preset type or default to SHORT """ - return FIELDS.get(key, {}).get("type", FieldType.SHORT) - - -def load_constants(): - """ Return the DEFAULTS extended by saved constants """ - data = get_defaults() - try: - with open(CONSTANTS_PATH, "r") as f: - loaded = json.load(f) - # Only overwrite already present keys with loaded constants - for key in data.keys(): - data[key] = loaded.get(key, data[key]) - except: - pass - return data - - -def store_constants(data): - """ Store {key: value} pairs """ - with open(CONSTANTS_PATH, "w") as f: - json.dump(data, f) - - -def update_constant(key, value): - data = load_constants() - data[key] = value - store_constants(data) - - -def get_constant(key): - data = load_constants() # this includes defaults - return data.get(key, None) diff --git a/Seeder/core/migrations/0001_initial.py b/Seeder/core/migrations/0001_initial.py new file mode 100644 index 00000000..3bb5dfcd --- /dev/null +++ b/Seeder/core/migrations/0001_initial.py @@ -0,0 +1,28 @@ +# Generated by Django 2.2.28 on 2024-08-29 14:18 + +import ckeditor.fields +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='SiteConfiguration', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('webarchive_size', models.CharField(default='595 TB', max_length=128)), + ('wayback_maintenance', models.BooleanField(default=False)), + ('wayback_maintenance_text_cs', ckeditor.fields.RichTextField(default='\n

Pokud vidíte tuto stránku, probíhá údržba dat a v archivu nelze nyní vyhledávat. Některé linky vrátí chybu.

\n

Prosím zkuste načíst Webarchiv později.

\n')), + ('wayback_maintenance_text_en', ckeditor.fields.RichTextField(default='\n

If you see this page, we are currently doing maintenance and it is not possible to search the archive. Some links may return an error.

\n

Please, try to load Webarchiv again later.

\n')), + ], + options={ + 'verbose_name': 'Site Configuration', + }, + ), + ] diff --git a/Seeder/core/migrations/__init__.py b/Seeder/core/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/Seeder/core/models.py b/Seeder/core/models.py index 44e681b2..147a9605 100644 --- a/Seeder/core/models.py +++ b/Seeder/core/models.py @@ -1,7 +1,9 @@ from django.db import models from django import forms from django.utils import timezone -from django.forms.widgets import DateTimeInput, SplitDateTimeWidget +from django.utils.translation import gettext_lazy as _ +from ckeditor.fields import RichTextField +from solo.models import SingletonModel from core import widgets @@ -41,3 +43,26 @@ class BaseModel(models.Model): class Meta: abstract = True ordering = ('-last_changed', ) + +class SiteConfiguration(SingletonModel): + """ Singleton model for Site Configuration """ + webarchive_size = models.CharField(max_length=128, default="595 TB") + wayback_maintenance = models.BooleanField(default=False) + wayback_maintenance_text_cs = RichTextField( + config_name='site_configuration', + default=""" +

Pokud vidíte tuto stránku, probíhá údržba dat a v archivu nelze nyní vyhledávat. Některé linky vrátí chybu.

+

Prosím zkuste načíst Webarchiv později.

+""") + wayback_maintenance_text_en = RichTextField( + config_name='site_configuration', + default=""" +

If you see this page, we are currently doing maintenance and it is not possible to search the archive. Some links may return an error.

+

Please, try to load Webarchiv again later.

+""") + + def __str__(self): + return str(_("Site Configuration")) + + class Meta: + verbose_name = _("Site Configuration") \ No newline at end of file diff --git a/Seeder/core/templatetags/core.py b/Seeder/core/templatetags/core.py index f0f30036..0f124c92 100644 --- a/Seeder/core/templatetags/core.py +++ b/Seeder/core/templatetags/core.py @@ -1,6 +1,7 @@ from django import template from django.conf import settings from django.utils.html import format_html +from core.models import SiteConfiguration register = template.Library() @@ -32,3 +33,11 @@ def user_in_group(user, group): ''' Check the provided user belongs to the provided group; all lowered ''' return (str.lower(group) in map(str.lower, user.groups.values_list("name", flat=True))) + +@register.simple_tag +def config(key): + """ + Retrieve a saved constant - returns a default/None if key doesn't exist + """ + config = SiteConfiguration.get_solo() + return getattr(config, key) diff --git a/Seeder/core/templatetags/json_constants.py b/Seeder/core/templatetags/json_constants.py deleted file mode 100644 index a33e9015..00000000 --- a/Seeder/core/templatetags/json_constants.py +++ /dev/null @@ -1,12 +0,0 @@ -from django import template -from core.json_constants import get_constant - -register = template.Library() - - -@register.simple_tag -def json_constant(key): - """ - Retrieve a saved constant - returns a default/None if key doesn't exist - """ - return get_constant(key) diff --git a/Seeder/core/urls.py b/Seeder/core/urls.py index b807d05b..3638021c 100644 --- a/Seeder/core/urls.py +++ b/Seeder/core/urls.py @@ -10,8 +10,8 @@ path('profile', UserProfileEdit.as_view(), name='user_edit'), path('crash_test', CrashTestView.as_view(), name='crash_test'), path('dev', DevNotesView.as_view(), name='dev_notes'), - path('json_constants', EditJsonConstantsView.as_view(), - name='json_constants'), + path('site_configuration', EditSiteConfigurationView.as_view(), + name='site_configuration'), path('toggle-wayback-maintenance', ToggleWaybackMaintenanceView.as_view(), name='toggle_wayback_maintenance'), ] diff --git a/Seeder/core/views.py b/Seeder/core/views.py index 4eee42df..9c1435ce 100644 --- a/Seeder/core/views.py +++ b/Seeder/core/views.py @@ -1,6 +1,3 @@ -from .json_constants import store_constants -from . import forms - from django.http.response import HttpResponseRedirect from django.views.generic.base import RedirectView, TemplateView, View from django.utils.translation import ugettext_lazy as _ @@ -10,7 +7,7 @@ from django.utils import translation from django.views.generic.edit import FormView, UpdateView -from core.json_constants import get_constant, update_constant +from . import forms, models from .generic_views import LoginMixin, MessageView, SuperuserRequiredMixin from .dashboard_data import get_cards, cards_registry, REVERSE_SESSION @@ -115,27 +112,30 @@ class DevNotesView(LoginMixin, TemplateView): template_name = 'dev_notes.html' -class EditJsonConstantsView(SuperuserRequiredMixin, FormView, MessageView): +class EditSiteConfigurationView( + SuperuserRequiredMixin, UpdateView, MessageView): """ View for superusers where they can change constants accessed elsewhere in the application. e.g. "webarchive_size" on WWW Index """ - form_class = forms.UpdateJsonConstantsForm + form_class = forms.SiteConfigurationForm template_name = 'edit_form.html' - success_url = reverse_lazy('core:json_constants') - view_name = "json_constants" + success_url = reverse_lazy('core:site_configuration') + view_name = "site_configuration" + + def get_object(self): + return models.SiteConfiguration.get_solo() def get_context_data(self, **kwargs): ctx = super().get_context_data(**kwargs) # This will show up in the page title & header w/ edit_form.html - ctx["object"] = _("Constants") + ctx["object"] = _("Site Configuration") return ctx def form_valid(self, form): - # Fields are created using constants' keys, so just store everything - store_constants(form.cleaned_data) - self.add_message(_("Constants successfully updated"), messages.SUCCESS) + self.add_message(_("Site Configuration successfully updated"), + messages.SUCCESS) return super().form_valid(form) @@ -145,8 +145,10 @@ class ToggleWaybackMaintenanceView(LoginMixin, View, MessageView): """ def post(self, request, *args, **kwargs): - maintenance = get_constant("wayback_maintenance") - update_constant("wayback_maintenance", not maintenance) + config = models.SiteConfiguration.get_solo() + maintenance = config.wayback_maintenance + config.wayback_maintenance = not maintenance + config.save() # Based on the original value before update if maintenance: self.add_message(_('Wayback maintenance turned OFF'), diff --git a/Seeder/locale/cs/LC_MESSAGES/django.po b/Seeder/locale/cs/LC_MESSAGES/django.po index 2639e2ad..23d383df 100644 --- a/Seeder/locale/cs/LC_MESSAGES/django.po +++ b/Seeder/locale/cs/LC_MESSAGES/django.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Seeder\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-29 10:04+0000\n" +"POT-Creation-Date: 2024-08-30 09:19+0000\n" "PO-Revision-Date: 2018-04-16 13:40+0200\n" "Last-Translator: mariehaskovcova , 2017\n" "Language-Team: Czech (https://www.transifex.com/webarchivecz/teams/43032/" @@ -358,7 +358,7 @@ msgstr "Smazat" msgid "Proceed with deletion?" msgstr "Pokračovat se smazáním?" -#: contracts/templates/contract.html:140 harvests/templates/calendar.html:51 +#: contracts/templates/contract.html:140 harvests/templates/calendar.html:50 #: source/templates/edit_seed.html:28 source/templates/source.html:221 #: templates/base.html:204 msgid "Close" @@ -468,7 +468,7 @@ msgstr "Rozpracovaná kontrola kvality" msgid "Sources needing QA" msgstr "Zdroje ke kontrole" -#: core/forms.py:22 +#: core/forms.py:21 msgid "Check this to delete this object" msgstr "Potvrďte pro odstranění" @@ -485,39 +485,40 @@ msgstr "Akce {0} nepovolena." msgid "Changes successfully saved." msgstr "Změny uloženy." -#: core/views.py:20 templates/base.html:88 templates/card_detail.html:9 +#: core/models.py:65 core/models.py:68 core/views.py:133 +#: templates/base.html:142 +msgid "Site Configuration" +msgstr "Konfigurace Webu" + +#: core/views.py:17 templates/base.html:88 templates/card_detail.html:9 msgid "Dashboard" msgstr "Hlavní stránka" -#: core/views.py:77 +#: core/views.py:74 msgid "Change user information" msgstr "Změnit uživatelské informace" -#: core/views.py:85 +#: core/views.py:82 msgid "Profile changed." msgstr "Profil změněn." -#: core/views.py:95 +#: core/views.py:92 msgid "Password changed successfully." msgstr "Heslo bylo úspěšně změněno." -#: core/views.py:132 templates/base.html:142 -msgid "Constants" -msgstr "Konstanty" - -#: core/views.py:138 -msgid "Constants successfully updated" -msgstr "Konstanty byly úspěšně změněny" +#: core/views.py:137 +msgid "Site Configuration successfully updated" +msgstr "Konfigurace Webu byla úspěšně aktualizována" -#: core/views.py:152 +#: core/views.py:154 msgid "Wayback maintenance turned OFF" msgstr "Údržba Wayback byla vypnuta" -#: core/views.py:155 +#: core/views.py:157 msgid "Wayback maintenance turned ON" msgstr "Údržba Wayback byla zapnuta" -#: harvests/admin.py:54 harvests/forms.py:57 harvests/forms.py:141 +#: harvests/admin.py:60 harvests/forms.py:60 harvests/forms.py:144 msgid "dataLimit cannot be over 1TB" msgstr "dataLimit nesmí být přes 1TB" @@ -525,7 +526,7 @@ msgstr "dataLimit nesmí být přes 1TB" msgid "One URL per line" msgstr "Jedna URL na řádku" -#: harvests/forms.py:204 +#: harvests/forms.py:207 msgid "" "Provide a text file with one seed per line which will overwrite all " "custom_seeds. The original custom_seeds will be backed up to the media/seeds/" @@ -535,7 +536,7 @@ msgstr "" "mimosystémová semínka. Původní semínka budou zálohována do media/seeds/" "backup složky." -#: harvests/forms.py:225 +#: harvests/forms.py:228 msgid "" "Custom seeds field is disabled because there are too many seeds to be " "displayed in an HTML text field." @@ -634,11 +635,11 @@ msgstr "Manuals" msgid "Combined" msgstr "Combined" -#: harvests/models.py:282 harvests/views.py:383 +#: harvests/models.py:282 harvests/views.py:384 msgid "ArchiveIt" msgstr "ArchiveIt" -#: harvests/models.py:285 harvests/views.py:385 +#: harvests/models.py:285 harvests/views.py:386 msgid "Tests" msgstr "Tests" @@ -746,7 +747,7 @@ msgstr "pole" msgid "Harvest Configuration" msgstr "Konfigurace sklizní" -#: harvests/models.py:853 harvests/views.py:398 templates/base.html:127 +#: harvests/models.py:853 harvests/views.py:399 templates/base.html:127 msgid "Harvest Configurations" msgstr "Konfigurace sklizní" @@ -949,45 +950,45 @@ msgstr "Všechny zdroje jsou otevřené?" msgid "Seeds" msgstr "Semínka" -#: harvests/views.py:58 templates/base.html:122 +#: harvests/views.py:59 templates/base.html:122 msgid "Harvests" msgstr "Sklizně" -#: harvests/views.py:113 harvests/views.py:131 +#: harvests/views.py:114 harvests/views.py:132 msgid "Harvest contains no seeds!" msgstr "" "Sklizeň neobsahuje žádná semínka! Tím pádem nemůže být zmrazena (stav " "nastaven na 'Připraveno na sklízení')" -#: harvests/views.py:353 harvests/views.py:372 +#: harvests/views.py:354 harvests/views.py:373 msgid "Available URLs for date" msgstr "Seznam URL pro datum" -#: harvests/views.py:357 +#: harvests/views.py:358 msgid "All seeds for Harvest" msgstr "Všechna semínka pro sklizeň" -#: harvests/views.py:384 +#: harvests/views.py:385 msgid "VNC" msgstr "VNC: Výběrové custom" -#: harvests/views.py:386 +#: harvests/views.py:387 msgid "Totals" msgstr "Totals: Všechna semínka" -#: harvests/views.py:445 +#: harvests/views.py:446 msgid "TopicCollections" msgstr "Tematické kolekce" -#: harvests/views.py:455 +#: harvests/views.py:456 msgid "Add TopicCollection" msgstr "Přidat tematickou kolekci" -#: harvests/views.py:497 +#: harvests/views.py:503 msgid "Cannot decode file to UTF-8" msgstr "Nelze dekódovat soubor do UTF-8" -#: harvests/views.py:499 +#: harvests/views.py:505 #, python-format msgid "" "Original custom_seeds have been backed to: %(url)s" -#: harvests/views.py:503 +#: harvests/views.py:509 msgid "Uploaded custom seeds will not be paired automatically" msgstr "Nahraná mimosystémová semínka nebudou automaticky párována" -#: harvests/views.py:558 +#: harvests/views.py:577 msgid "ExternalTopicCollections" msgstr "Externí tematické kolekce" -#: harvests/views.py:568 +#: harvests/views.py:587 msgid "Add ExternalTopicCollection" msgstr "Přidat Externí tematickou kolekci" -#: harvests/views.py:652 +#: harvests/views.py:671 msgid "Topic collection published" msgstr "Tematická kolekce publikována" -#: harvests/views.py:654 +#: harvests/views.py:673 msgid "Topic collection unpublished" msgstr "Tematická kolekce nepublikována" -#: harvests/views.py:668 +#: harvests/views.py:687 msgid "URL slug successfully updated" msgstr "URL byla úspěšné změněna" diff --git a/Seeder/locale/en_US/LC_MESSAGES/django.po b/Seeder/locale/en_US/LC_MESSAGES/django.po index adb3aa14..24bc648f 100644 --- a/Seeder/locale/en_US/LC_MESSAGES/django.po +++ b/Seeder/locale/en_US/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Seeder\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-29 10:04+0000\n" +"POT-Creation-Date: 2024-08-30 09:19+0000\n" "PO-Revision-Date: 2017-11-07 12:38+0100\n" "Last-Translator: Visgean Skeloru , 2017\n" "Language-Team: English (United States) (https://www.transifex.com/" @@ -359,7 +359,7 @@ msgstr "Delete" msgid "Proceed with deletion?" msgstr "Proceed with deletion?" -#: contracts/templates/contract.html:140 harvests/templates/calendar.html:51 +#: contracts/templates/contract.html:140 harvests/templates/calendar.html:50 #: source/templates/edit_seed.html:28 source/templates/source.html:221 #: templates/base.html:204 msgid "Close" @@ -471,7 +471,7 @@ msgstr "Opened QAs" msgid "Sources needing QA" msgstr "Sources needing QA" -#: core/forms.py:22 +#: core/forms.py:21 msgid "Check this to delete this object" msgstr "Check this to delete this object" @@ -488,39 +488,40 @@ msgstr "Action {0} not allowed." msgid "Changes successfully saved." msgstr "Changes successfully saved." -#: core/views.py:20 templates/base.html:88 templates/card_detail.html:9 +#: core/models.py:65 core/models.py:68 core/views.py:133 +#: templates/base.html:142 +msgid "Site Configuration" +msgstr "Site Configuration" + +#: core/views.py:17 templates/base.html:88 templates/card_detail.html:9 msgid "Dashboard" msgstr "Dashboard" -#: core/views.py:77 +#: core/views.py:74 msgid "Change user information" msgstr "Change user information" -#: core/views.py:85 +#: core/views.py:82 msgid "Profile changed." msgstr "Profile changed." -#: core/views.py:95 +#: core/views.py:92 msgid "Password changed successfully." msgstr "Password changed successfully." -#: core/views.py:132 templates/base.html:142 -msgid "Constants" -msgstr "Constants" - -#: core/views.py:138 -msgid "Constants successfully updated" -msgstr "Constants successfully updated" +#: core/views.py:137 +msgid "Site Configuration successfully updated" +msgstr "Site Configuration successfully updated" -#: core/views.py:152 +#: core/views.py:154 msgid "Wayback maintenance turned OFF" msgstr "Wayback maintenance turned OFF" -#: core/views.py:155 +#: core/views.py:157 msgid "Wayback maintenance turned ON" msgstr "Wayback maintenance turned ON" -#: harvests/admin.py:54 harvests/forms.py:57 harvests/forms.py:141 +#: harvests/admin.py:60 harvests/forms.py:60 harvests/forms.py:144 msgid "dataLimit cannot be over 1TB" msgstr "dataLimit cannot be over 1TB" @@ -528,7 +529,7 @@ msgstr "dataLimit cannot be over 1TB" msgid "One URL per line" msgstr "One URL per line" -#: harvests/forms.py:204 +#: harvests/forms.py:207 msgid "" "Provide a text file with one seed per line which will overwrite all " "custom_seeds. The original custom_seeds will be backed up to the media/seeds/" @@ -538,7 +539,7 @@ msgstr "" "custom_seeds. The original custom_seeds will be backed up to the media/seeds/" "backup folder." -#: harvests/forms.py:225 +#: harvests/forms.py:228 msgid "" "Custom seeds field is disabled because there are too many seeds to be " "displayed in an HTML text field." @@ -637,11 +638,11 @@ msgstr "Manuals" msgid "Combined" msgstr "Combined" -#: harvests/models.py:282 harvests/views.py:383 +#: harvests/models.py:282 harvests/views.py:384 msgid "ArchiveIt" msgstr "ArchiveIt" -#: harvests/models.py:285 harvests/views.py:385 +#: harvests/models.py:285 harvests/views.py:386 msgid "Tests" msgstr "Tests" @@ -749,7 +750,7 @@ msgstr "file" msgid "Harvest Configuration" msgstr "Harvest Configuration" -#: harvests/models.py:853 harvests/views.py:398 templates/base.html:127 +#: harvests/models.py:853 harvests/views.py:399 templates/base.html:127 msgid "Harvest Configurations" msgstr "Harvest Configurations" @@ -952,45 +953,45 @@ msgstr "All sources are open?" msgid "Seeds" msgstr "Seeds" -#: harvests/views.py:58 templates/base.html:122 +#: harvests/views.py:59 templates/base.html:122 msgid "Harvests" msgstr "Harvests" -#: harvests/views.py:113 harvests/views.py:131 +#: harvests/views.py:114 harvests/views.py:132 msgid "Harvest contains no seeds!" msgstr "" "Harvest contains no seeds! This means it cannot be frozen (set as 'Ready to " "harvest')" -#: harvests/views.py:353 harvests/views.py:372 +#: harvests/views.py:354 harvests/views.py:373 msgid "Available URLs for date" msgstr "Available URLs for date" -#: harvests/views.py:357 +#: harvests/views.py:358 msgid "All seeds for Harvest" msgstr "All seeds for Harvest" -#: harvests/views.py:384 +#: harvests/views.py:385 msgid "VNC" msgstr "VNC: Custom seeds" -#: harvests/views.py:386 +#: harvests/views.py:387 msgid "Totals" msgstr "Totals: All seeds" -#: harvests/views.py:445 +#: harvests/views.py:446 msgid "TopicCollections" msgstr "Topic Collections" -#: harvests/views.py:455 +#: harvests/views.py:456 msgid "Add TopicCollection" msgstr "Add Topic Collection" -#: harvests/views.py:497 +#: harvests/views.py:503 msgid "Cannot decode file to UTF-8" msgstr "Cannot decode file to UTF-8" -#: harvests/views.py:499 +#: harvests/views.py:505 #, python-format msgid "" "Original custom_seeds have been backed to: %(url)s" -#: harvests/views.py:503 +#: harvests/views.py:509 msgid "Uploaded custom seeds will not be paired automatically" msgstr "Uploaded custom seeds will not be paired automatically" -#: harvests/views.py:558 +#: harvests/views.py:577 msgid "ExternalTopicCollections" msgstr "External Topic Collections" -#: harvests/views.py:568 +#: harvests/views.py:587 msgid "Add ExternalTopicCollection" msgstr "Add External Topic Collection" -#: harvests/views.py:652 +#: harvests/views.py:671 msgid "Topic collection published" msgstr "Topic collection published" -#: harvests/views.py:654 +#: harvests/views.py:673 msgid "Topic collection unpublished" msgstr "Topic collection unpublished" -#: harvests/views.py:668 +#: harvests/views.py:687 msgid "URL slug successfully updated" msgstr "URL slug successfully updated" diff --git a/Seeder/settings/base.py b/Seeder/settings/base.py index a343010d..117c5b5b 100755 --- a/Seeder/settings/base.py +++ b/Seeder/settings/base.py @@ -90,8 +90,8 @@ 'rest_framework.authtoken', 'captcha', 'ordered_model', + 'solo', # 'elasticstack', - 'core', 'publishers', 'source', @@ -235,7 +235,7 @@ 'width': 800, 'height': 100, }, - 'json_constants': { + 'site_configuration': { 'toolbar': 'Custom', 'toolbar_Custom': [ ['Bold', 'Italic', 'Underline', 'FontSize'], diff --git a/Seeder/templates/base.html b/Seeder/templates/base.html index a85caaea..18913854 100755 --- a/Seeder/templates/base.html +++ b/Seeder/templates/base.html @@ -1,5 +1,5 @@ -{% load bootstrap3 i18n raven core static json_constants %} -{% json_constant "wayback_maintenance" as wayback_maintenance%} +{% load bootstrap3 i18n raven core static %} +{% config "wayback_maintenance" as wayback_maintenance%} @@ -138,8 +138,8 @@ {% trans 'Search logs' %} {% if user.is_superuser %} -
  • - {% trans 'Constants' %} +
  • + {% trans 'Site Configuration' %}
  • {% endif %} diff --git a/Seeder/www/forms.py b/Seeder/www/forms.py index 83934ac2..32d2c5b3 100644 --- a/Seeder/www/forms.py +++ b/Seeder/www/forms.py @@ -4,7 +4,7 @@ from dal import autocomplete from . import models -from core.json_constants import get_constant +from core.models import SiteConfiguration class BigSearchForm(forms.Form): @@ -14,7 +14,7 @@ class BigSearchForm(forms.Form): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) # If wayback maintenance is on, disable the search box - maintenance = get_constant("wayback_maintenance") or False + maintenance = SiteConfiguration.get_solo().wayback_maintenance or False self.fields["query"].disabled = maintenance if maintenance: self.fields["query"].widget.attrs["placeholder"] = _( diff --git a/Seeder/www/templates/base_www.html b/Seeder/www/templates/base_www.html index c53ef1dd..b44c3509 100644 --- a/Seeder/www/templates/base_www.html +++ b/Seeder/www/templates/base_www.html @@ -1,6 +1,6 @@ -{% load i18n raven core json_constants %} +{% load i18n raven core %} {% get_current_language as lang %} -{% json_constant "wayback_maintenance" as wayback_maintenance%} +{% config "wayback_maintenance" as wayback_maintenance%} @@ -110,9 +110,9 @@
    {% if lang == "cs" %} - {% json_constant "wayback_maintenance_text_cs" as text %} + {% config "wayback_maintenance_text_cs" as text %} {% else %} - {% json_constant "wayback_maintenance_text_en" as text %} + {% config "wayback_maintenance_text_en" as text %} {% endif %} {{ text|safe }}
    diff --git a/Seeder/www/templates/index.html b/Seeder/www/templates/index.html index 873500f1..d91b2ae3 100644 --- a/Seeder/www/templates/index.html +++ b/Seeder/www/templates/index.html @@ -1,6 +1,5 @@ {% extends "base_www.html" %} -{% load i18n %} -{% load json_constants %} +{% load i18n core %} {% get_current_language as lang %} @@ -143,14 +142,14 @@

    {{ news_article.source_2 } {% if lang == "cs" %}

    Webarchiv k {% now "SHORT_DATE_FORMAT" %} obsahuje {% json_constant "webarchive_size" %} dat. První dokument byl + class="h1-size">{% config "webarchive_size" %} dat. První dokument byl archivován 3. 9. 2001.



    Celkem jsme s autory uzavřeli {{ contract_count }} smluv. Poslední aktuální smlouvy:

    {% else %}

    Webarchiv contains to {% now "SHORT_DATE_FORMAT" %} {% json_constant "webarchive_size" %} data. The first website + class="h1-size">{% config "webarchive_size" %} data. The first website was harvested in 3. 9. 2001.



    We concluded {{ contract_count }} contracts with a publishers at the diff --git a/requirements.txt b/requirements.txt index 2fefc016..2156f0f8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -24,6 +24,7 @@ django-multiupload==0.5.2 django-ordered-model==3.3.0 django-recaptcha==1.3.1 django-reversion==3.0.2 +django-solo==2.0.0 django-tables2==2.0.0a3 Django==2.2.28 djangorestframework==3.11.2 From 37488e42c3da4aed118226be7bfe05539df4dbfd Mon Sep 17 00:00:00 2001 From: Fasand Date: Fri, 30 Aug 2024 11:49:23 +0200 Subject: [PATCH 2/8] #653: add SourceFilter for issn__contains --- Seeder/source/field_filters.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Seeder/source/field_filters.py b/Seeder/source/field_filters.py index 99ab1470..795cd618 100755 --- a/Seeder/source/field_filters.py +++ b/Seeder/source/field_filters.py @@ -78,4 +78,5 @@ class Meta: 'dead_source': ('exact',), 'created': ('exact',), 'last_changed': ('exact',), + 'issn': ('contains',), } From ad698c2e04e85b97057a8819004f702898013f1f Mon Sep 17 00:00:00 2001 From: Fasand Date: Fri, 30 Aug 2024 12:38:12 +0200 Subject: [PATCH 3/8] #681: fix broken sorting by title, use text method instead of __str__ --- Seeder/harvests/tables.py | 8 ++++---- Seeder/www/tables.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Seeder/harvests/tables.py b/Seeder/harvests/tables.py index 0db8d18e..408ab768 100755 --- a/Seeder/harvests/tables.py +++ b/Seeder/harvests/tables.py @@ -72,8 +72,8 @@ class TopicCollectionTable(tables.Table): created = NaturalDatetimeColumn() last_changed = NaturalDatetimeColumn() title = AbsoluteURLColumn( - accessor='__str__', - verbose_name=_('title') + verbose_name=_('title'), + text=lambda record: str(record), # str() has checkmark ) class Meta: @@ -89,8 +89,8 @@ class ExternalTopicCollectionTable(tables.Table): created = NaturalDatetimeColumn() last_changed = NaturalDatetimeColumn() title = AbsoluteURLColumn( - accessor='__str__', - verbose_name=_('title') + verbose_name=_('title'), + text=lambda record: str(record), # str() has checkmark ) change_order = ChangeOrderColumn(accessor='pk') diff --git a/Seeder/www/tables.py b/Seeder/www/tables.py index d8f78d36..6a3ffa4b 100755 --- a/Seeder/www/tables.py +++ b/Seeder/www/tables.py @@ -10,8 +10,8 @@ class NewsTable(tables.Table): created = NaturalDatetimeColumn() last_changed = NaturalDatetimeColumn() title = AbsoluteURLColumn( - accessor='__str__', - verbose_name=_('title') + verbose_name=_('title'), + text=lambda record: str(record), # str() has checkmark ) class Meta: From 0939bbc68856d3a58fe6f645ecceb2dc82a3667f Mon Sep 17 00:00:00 2001 From: Fasand Date: Fri, 30 Aug 2024 12:46:21 +0200 Subject: [PATCH 4/8] #678: ArchiveIt seeds now disregard source frequency, all archiving Seeds considered --- Seeder/harvests/models.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Seeder/harvests/models.py b/Seeder/harvests/models.py index 46a961a1..3a5a5e7f 100755 --- a/Seeder/harvests/models.py +++ b/Seeder/harvests/models.py @@ -482,9 +482,8 @@ def get_oneshot_seeds(self): def get_archiveit_seeds(self): if not self.archive_it: return set() - # Get all potential ArchiveIt seeds - archiveit = Seed.objects.archiving().filter( - source__frequency__in=[1, 2, 4, 6]) + # Get all potential ArchiveIt seeds across all source frequencies + archiveit = Seed.objects.archiving() archiveit = set(archiveit.values_list('url', flat=True)) # Get all harvested seeds up to this Harvest's scheduled date previously_harvested = self.get_previously_harvested() From 2dedf9132cc1b9610f7b98d2b339b111d2498e4f Mon Sep 17 00:00:00 2001 From: Fasand Date: Sun, 15 Dec 2024 16:08:03 +0100 Subject: [PATCH 5/8] #696: update tld package to enable .art and other TLDs --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 2156f0f8..bc197bcb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -58,7 +58,7 @@ sorl-thumbnail==12.8.0 Sphinx==1.4.4 sqlparse==0.4.4 tablib[all]==3.4.0 -tld==0.7.6 +tld==0.13 unicodecsv==0.14.1 Unidecode==1.1.1 uritemplate==4.1.1 From da10ced2faff7df023916646320354d18fa5015f Mon Sep 17 00:00:00 2001 From: Fasand Date: Sun, 15 Dec 2024 16:23:20 +0100 Subject: [PATCH 6/8] #702: add Source.priority_source similar to dead_source, update translations and filters --- Seeder/locale/cs/LC_MESSAGES/django.po | 176 +++++++++--------- Seeder/locale/en_US/LC_MESSAGES/django.po | 176 +++++++++--------- Seeder/source/field_filters.py | 1 + Seeder/source/forms.py | 3 +- .../migrations/0008_source_priority_source.py | 18 ++ Seeder/source/models.py | 4 +- Seeder/source/tables.py | 4 +- Seeder/source/templates/source.html | 4 + 8 files changed, 210 insertions(+), 176 deletions(-) create mode 100644 Seeder/source/migrations/0008_source_priority_source.py diff --git a/Seeder/locale/cs/LC_MESSAGES/django.po b/Seeder/locale/cs/LC_MESSAGES/django.po index 23d383df..6a32a140 100644 --- a/Seeder/locale/cs/LC_MESSAGES/django.po +++ b/Seeder/locale/cs/LC_MESSAGES/django.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Seeder\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-30 09:19+0000\n" +"POT-Creation-Date: 2024-12-15 15:19+0000\n" "PO-Revision-Date: 2018-04-16 13:40+0200\n" "Last-Translator: mariehaskovcova , 2017\n" "Language-Team: Czech (https://www.transifex.com/webarchivecz/teams/43032/" @@ -60,8 +60,8 @@ msgstr "Dump" #: harvests/templates/harvest.html:9 harvests/templates/harvest_config.html:11 #: harvests/templates/topic_collection.html:106 #: publishers/templates/publisher.html:36 source/templates/edit_source.html:7 -#: source/templates/edit_source.html:11 source/templates/source.html:157 -#: source/templates/source.html:166 templates/edit_form.html:6 +#: source/templates/edit_source.html:11 source/templates/source.html:161 +#: source/templates/source.html:170 templates/edit_form.html:6 #: templates/edit_form.html:10 www/templates/news_admin_detail.html:84 msgid "Edit" msgstr "Upravit" @@ -71,7 +71,7 @@ msgstr "Upravit" #: harvests/templates/external_topic_collection.html:97 #: harvests/templates/harvest_config.html:13 #: harvests/templates/topic_collection.html:107 -#: publishers/templates/publisher.html:35 source/templates/source.html:168 +#: publishers/templates/publisher.html:35 source/templates/source.html:172 #: www/templates/news_admin_detail.html:86 msgid "History" msgstr "Historie" @@ -151,7 +151,7 @@ msgid "This comment has been removed" msgstr "Komentář byl odstraněn" #: comments/models.py:168 qa/models.py:40 qa/templates/detail.html:30 -#: source/models.py:255 source/models.py:535 source/templates/source.html:83 +#: source/models.py:255 source/models.py:537 source/templates/source.html:87 #: templates/history.html:14 msgid "Comment" msgstr "Komentář" @@ -161,7 +161,7 @@ msgstr "Komentář" #: harvests/templates/harvest.html:110 #: harvests/templates/topic_collection.html:112 #: publishers/templates/publisher.html:39 qa/templates/detail.html:41 -#: source/templates/source.html:200 voting/templates/voting_round.html:118 +#: source/templates/source.html:204 voting/templates/voting_round.html:118 #: www/templates/news_admin_detail.html:90 msgid "Comments" msgstr "Komentáře" @@ -215,7 +215,7 @@ msgid "Narodni knihovna CR - archivace Vasich webovych stranek" msgstr "Narodni knihovna CR - archivace Vasich webovych stranek" #: contracts/models.py:55 contracts/templates/contract.html:21 -#: harvests/models.py:235 harvests/models.py:717 source/models.py:269 +#: harvests/models.py:235 harvests/models.py:716 source/models.py:269 #: voting/models.py:27 msgid "State" msgstr "Stav" @@ -308,7 +308,7 @@ msgstr "Creative Commons" #: contracts/templates/contract.html:43 publishers/models.py:30 #: source/constants.py:121 source/models.py:244 source/tables.py:10 -#: source/templates/duplicity_check.html:20 source/templates/source.html:72 +#: source/templates/duplicity_check.html:20 source/templates/source.html:76 msgid "Publisher" msgstr "Vydavatel" @@ -343,7 +343,7 @@ msgstr "Přiřazené zdroje" #: contracts/templates/contract.html:113 #: harvests/templates/external_topic_collection.html:95 #: harvests/templates/topic_collection.html:105 -#: publishers/templates/publisher.html:34 source/templates/source.html:165 +#: publishers/templates/publisher.html:34 source/templates/source.html:169 #: www/templates/news_admin_detail.html:83 msgid "Links" msgstr "Odkazy" @@ -354,12 +354,12 @@ msgid "Delete" msgstr "Smazat" #: contracts/templates/contract.html:131 source/templates/edit_seed.html:16 -#: source/templates/source.html:210 +#: source/templates/source.html:214 msgid "Proceed with deletion?" msgstr "Pokračovat se smazáním?" #: contracts/templates/contract.html:140 harvests/templates/calendar.html:50 -#: source/templates/edit_seed.html:28 source/templates/source.html:221 +#: source/templates/edit_seed.html:28 source/templates/source.html:225 #: templates/base.html:204 msgid "Close" msgstr "Zavřít" @@ -415,7 +415,7 @@ msgstr "Přiřadit smlouvu" msgid "Contract number assigned." msgstr "Smlouvě bylo přiřazeno číslo." -#: contracts/views.py:134 source/templates/source.html:189 +#: contracts/views.py:134 source/templates/source.html:193 #: templates/base.html:100 msgid "Contracts" msgstr "Smlouvy" @@ -568,7 +568,7 @@ msgstr "Plánované" msgid "Ready to harvest" msgstr "Připraveno na sklízení" -#: harvests/models.py:209 harvests/models.py:694 +#: harvests/models.py:209 harvests/models.py:693 msgid "Running" msgstr "Probíhající" @@ -588,22 +588,22 @@ msgstr "Zrušené" msgid "Failed" msgstr "Neúspěšné" -#: harvests/models.py:237 harvests/models.py:839 +#: harvests/models.py:237 harvests/models.py:838 #: harvests/templates/harvest.html:19 harvests/templates/harvest_config.html:18 msgid "Harvest type" msgstr "Typ sklizně" -#: harvests/models.py:239 harvests/models.py:603 harvests/models.py:721 -#: harvests/tables.py:76 harvests/tables.py:93 www/tables.py:14 +#: harvests/models.py:239 harvests/models.py:602 harvests/models.py:720 +#: harvests/tables.py:75 harvests/tables.py:92 www/tables.py:13 msgid "title" msgstr "Název" #: harvests/models.py:241 harvests/templates/harvest.html:17 -#: source/models.py:256 source/templates/source.html:87 +#: source/models.py:256 source/templates/source.html:91 msgid "Annotation" msgstr "Anotace" -#: harvests/models.py:243 harvests/models.py:736 +#: harvests/models.py:243 harvests/models.py:735 msgid "Date of harvest" msgstr "Datum sklizně" @@ -643,27 +643,27 @@ msgstr "ArchiveIt" msgid "Tests" msgstr "Tests" -#: harvests/models.py:289 harvests/models.py:841 +#: harvests/models.py:289 harvests/models.py:840 #: harvests/templates/harvest.html:65 harvests/templates/harvest_config.html:20 msgid "duration" msgstr "duration" -#: harvests/models.py:291 harvests/models.py:843 +#: harvests/models.py:291 harvests/models.py:842 #: harvests/templates/harvest.html:67 harvests/templates/harvest_config.html:22 msgid "budget" msgstr "budget" -#: harvests/models.py:293 harvests/models.py:845 +#: harvests/models.py:293 harvests/models.py:844 #: harvests/templates/harvest.html:69 harvests/templates/harvest_config.html:24 msgid "dataLimit" msgstr "dataLimit" -#: harvests/models.py:295 harvests/models.py:847 +#: harvests/models.py:295 harvests/models.py:846 #: harvests/templates/harvest.html:71 harvests/templates/harvest_config.html:26 msgid "documentLimit" msgstr "documentLimit" -#: harvests/models.py:297 harvests/models.py:849 +#: harvests/models.py:297 harvests/models.py:848 #: harvests/templates/harvest.html:73 harvests/templates/harvest_config.html:28 msgid "deduplication" msgstr "deduplication" @@ -672,86 +672,86 @@ msgstr "deduplication" msgid "Seeds not harvested" msgstr "Nesklizená semínka" -#: harvests/models.py:607 harvests/models.py:724 source/constants.py:124 +#: harvests/models.py:606 harvests/models.py:723 source/constants.py:124 #: source/models.py:240 msgid "Curator" msgstr "Kurátor" -#: harvests/models.py:611 source/templates/source.html:91 +#: harvests/models.py:610 source/templates/source.html:95 msgid "keywords" msgstr "Klíčová slova" -#: harvests/models.py:614 harvests/models.py:741 +#: harvests/models.py:613 harvests/models.py:740 msgid "annotation" msgstr "anotace" -#: harvests/models.py:618 +#: harvests/models.py:617 msgid "image" msgstr "obrázek" -#: harvests/models.py:677 harvests/templates/topic_collection.html:13 +#: harvests/models.py:676 harvests/templates/topic_collection.html:13 msgid "External Topic Collection" msgstr "Externí tematická kolekce" -#: harvests/models.py:678 templates/base.html:110 +#: harvests/models.py:677 templates/base.html:110 msgid "External Topic Collections" msgstr "Externí tematické kolekce" -#: harvests/models.py:695 +#: harvests/models.py:694 msgid "New" msgstr "Aktualita" -#: harvests/models.py:696 +#: harvests/models.py:695 msgid "Finished" msgstr "Hotovo" -#: harvests/models.py:708 harvests/templates/topic_collection.html:49 -#: source/models.py:275 source/templates/source.html:56 templates/api.html:17 +#: harvests/models.py:707 harvests/templates/topic_collection.html:49 +#: source/models.py:275 source/templates/source.html:60 templates/api.html:17 msgid "Frequency" msgstr "Frekvence" -#: harvests/models.py:745 +#: harvests/models.py:744 msgid "All sources are under open license or contract" msgstr "Všechny zdroje jsou nasmlouvány nebo vystaveny pod otevřenou licencí" -#: harvests/models.py:748 +#: harvests/models.py:747 msgid "Date from" msgstr "Od" -#: harvests/models.py:749 +#: harvests/models.py:748 msgid "Date to" msgstr "Do" -#: harvests/models.py:753 harvests/templates/topic_collection.html:24 +#: harvests/models.py:752 harvests/templates/topic_collection.html:24 msgid "Collection alias" msgstr "Alias kolekce" -#: harvests/models.py:755 harvests/templates/topic_collection.html:82 +#: harvests/models.py:754 harvests/templates/topic_collection.html:82 msgid "Aggregation with same type" msgstr "Agregovat se stejným typem" -#: harvests/models.py:811 +#: harvests/models.py:810 msgid "Internal Topic Collection" msgstr "Interní tematická kolekce" -#: harvests/models.py:812 harvests/templates/external_topic_collection.html:82 +#: harvests/models.py:811 harvests/templates/external_topic_collection.html:82 #: templates/base.html:113 msgid "Internal Topic Collections" msgstr "Interní tematické kolekce" -#: harvests/models.py:818 +#: harvests/models.py:817 msgid "file" msgstr "pole" -#: harvests/models.py:852 +#: harvests/models.py:851 msgid "Harvest Configuration" msgstr "Konfigurace sklizní" -#: harvests/models.py:853 harvests/views.py:399 templates/base.html:127 +#: harvests/models.py:852 harvests/views.py:399 templates/base.html:127 msgid "Harvest Configurations" msgstr "Konfigurace sklizní" -#: harvests/models.py:857 +#: harvests/models.py:856 #, python-format msgid "Configuration for %(type)s Harvests" msgstr "Konfigurace pro %(type)s Sklizně" @@ -821,13 +821,13 @@ msgid "Screenshot" msgstr "Screenshot" #: harvests/templates/external_topic_collection.html:51 -#: harvests/templates/topic_collection.html:65 source/templates/source.html:64 +#: harvests/templates/topic_collection.html:65 source/templates/source.html:68 #: www/templates/news_admin_detail.html:76 msgid "Created at" msgstr "Vytvořeno" #: harvests/templates/external_topic_collection.html:55 -#: harvests/templates/topic_collection.html:69 source/templates/source.html:52 +#: harvests/templates/topic_collection.html:69 source/templates/source.html:56 msgid "Owner" msgstr "Kurátor" @@ -836,7 +836,7 @@ msgid "Keywords" msgstr "Klíčová slova" #: harvests/templates/external_topic_collection.html:66 -#: source/templates/source.html:130 +#: source/templates/source.html:134 msgid "WWW link" msgstr "Link na web" @@ -946,7 +946,7 @@ msgid "All sources are open?" msgstr "Všechny zdroje jsou otevřené?" #: harvests/templates/topic_collection.html:94 qa/templates/qa_form.html:20 -#: source/models.py:564 source/templates/source.html:152 +#: source/models.py:566 source/templates/source.html:156 msgid "Seeds" msgstr "Semínka" @@ -1068,7 +1068,7 @@ msgstr "Telefon" msgid "Address" msgstr "Adresa" -#: publishers/models.py:65 source/templates/source.html:76 +#: publishers/models.py:65 source/templates/source.html:80 msgid "Publisher contact" msgstr "Kontakt na vydavatele" @@ -1084,7 +1084,7 @@ msgstr "Kontakty:" msgid "Edit contacts" msgstr "Editovat kontakty" -#: publishers/templates/publisher.html:24 source/models.py:307 +#: publishers/templates/publisher.html:24 source/models.py:308 #: source/views.py:254 templates/base.html:94 msgid "Sources" msgstr "Zdroje" @@ -1093,7 +1093,7 @@ msgstr "Zdroje" msgid "Add publisher" msgstr "Přidat vydavatele" -#: qa/models.py:18 qa/templates/detail.html:13 source/models.py:306 +#: qa/models.py:18 qa/templates/detail.html:13 source/models.py:307 msgid "Source" msgstr "Zdroj" @@ -1249,7 +1249,7 @@ msgstr "Ukončeno vydávání" msgid "Visitor" msgstr "Návstěvník" -#: source/constants.py:123 source/templates/source.html:110 +#: source/constants.py:123 source/templates/source.html:114 msgid "ISSN" msgstr "ISSN" @@ -1285,15 +1285,15 @@ msgstr "" "Zdroje se stavem 'Archivován' a 'Archivován bez smlouvy' musí mít vybranou " "Frekvenci sklízení" -#: source/models.py:259 source/templates/source.html:68 +#: source/models.py:259 source/templates/source.html:72 msgid "Suggested by" msgstr "Navrženo" -#: source/models.py:280 source/templates/source.html:98 +#: source/models.py:280 source/templates/source.html:102 msgid "Category" msgstr "Kategorie" -#: source/models.py:285 source/templates/source.html:102 +#: source/models.py:285 source/templates/source.html:106 msgid "Sub category" msgstr "Podkategorie" @@ -1301,63 +1301,67 @@ msgstr "Podkategorie" msgid "Source is dead" msgstr "Mrtvý web" -#: source/models.py:516 +#: source/models.py:298 source/templates/source.html:52 +msgid "Priority source" +msgstr "Prioritní zdroj" + +#: source/models.py:518 msgid "default" msgstr "výchozí" -#: source/models.py:517 +#: source/models.py:519 msgid "low" msgstr "low" -#: source/models.py:518 +#: source/models.py:520 msgid "very_low" msgstr "very low" -#: source/models.py:529 +#: source/models.py:531 msgid "Main seed" msgstr "Hlavní semínko" -#: source/models.py:530 +#: source/models.py:532 msgid "Seed url" msgstr "URL semínko" -#: source/models.py:536 +#: source/models.py:538 msgid "From" msgstr "Od" -#: source/models.py:537 +#: source/models.py:539 msgid "To" msgstr "Do" -#: source/models.py:540 +#: source/models.py:542 msgid "Javascript" msgstr "Javascript" -#: source/models.py:541 +#: source/models.py:543 msgid "Global reject" msgstr "Odmítnuto" -#: source/models.py:542 +#: source/models.py:544 msgid "Youtube" msgstr "Youtube" -#: source/models.py:543 +#: source/models.py:545 msgid "Calendars" msgstr "Kalendáře" -#: source/models.py:544 +#: source/models.py:546 msgid "Local traps" msgstr "Local traps" -#: source/models.py:545 +#: source/models.py:547 msgid "Redirect on seed" msgstr "Přesměrováno na semínko" -#: source/models.py:546 +#: source/models.py:548 msgid "Robots.txt active" msgstr "aktivní Robots.txt" -#: source/models.py:563 +#: source/models.py:565 msgid "Seed" msgstr "Semínko" @@ -1387,67 +1391,67 @@ msgstr "K tomuto zdroji je přiřazen screenshot, ale jeho soubor neexistuje" msgid "Dead" msgstr "Mrtvý" -#: source/templates/source.html:60 +#: source/templates/source.html:64 msgid "Created by" msgstr "Vytvořil" -#: source/templates/source.html:106 +#: source/templates/source.html:110 msgid "Aleph id" msgstr "Aleph id" -#: source/templates/source.html:114 +#: source/templates/source.html:118 msgid "QA checks" msgstr "Provedení kontroly kvality" -#: source/templates/source.html:124 +#: source/templates/source.html:128 msgid "WA-admin link" msgstr "WA Admin link" -#: source/templates/source.html:125 +#: source/templates/source.html:129 msgid "Legacy url" msgstr "Stará URL" -#: source/templates/source.html:143 +#: source/templates/source.html:147 msgid "No" msgstr "Ne" -#: source/templates/source.html:161 +#: source/templates/source.html:165 msgid "Add seeds" msgstr "Přidat semínka" -#: source/templates/source.html:167 +#: source/templates/source.html:171 msgid "WA-KAT" msgstr "WA-KAT" -#: source/templates/source.html:169 +#: source/templates/source.html:173 msgid "QA check" msgstr "Provedení kontroly kvality" -#: source/templates/source.html:174 source/templates/source.html:217 +#: source/templates/source.html:178 source/templates/source.html:221 msgid "Deactivate" msgstr "Deaktivovat" -#: source/templates/source.html:179 +#: source/templates/source.html:183 msgid "Voting rounds" msgstr "Hodnocení" -#: source/templates/source.html:182 +#: source/templates/source.html:186 msgid "Create voting round" msgstr "Vytvoření hodnocení" -#: source/templates/source.html:193 +#: source/templates/source.html:197 msgid "Sorry no contracts yet." msgstr "Zatím bez smlouvy." -#: source/templates/source.html:195 +#: source/templates/source.html:199 msgid "Create" msgstr "Vytvořit" -#: source/templates/source.html:196 +#: source/templates/source.html:200 msgid "Assign" msgstr "Přiřadit" -#: source/templates/source.html:213 +#: source/templates/source.html:217 msgid "If you proceed it will be very hard to reactivate this source." msgstr "Pokud budete pokračovat, bude velmi těžké zdroj znovu aktivovat." diff --git a/Seeder/locale/en_US/LC_MESSAGES/django.po b/Seeder/locale/en_US/LC_MESSAGES/django.po index 24bc648f..60829993 100644 --- a/Seeder/locale/en_US/LC_MESSAGES/django.po +++ b/Seeder/locale/en_US/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Seeder\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-30 09:19+0000\n" +"POT-Creation-Date: 2024-12-15 15:19+0000\n" "PO-Revision-Date: 2017-11-07 12:38+0100\n" "Last-Translator: Visgean Skeloru , 2017\n" "Language-Team: English (United States) (https://www.transifex.com/" @@ -59,8 +59,8 @@ msgstr "Dump" #: harvests/templates/harvest.html:9 harvests/templates/harvest_config.html:11 #: harvests/templates/topic_collection.html:106 #: publishers/templates/publisher.html:36 source/templates/edit_source.html:7 -#: source/templates/edit_source.html:11 source/templates/source.html:157 -#: source/templates/source.html:166 templates/edit_form.html:6 +#: source/templates/edit_source.html:11 source/templates/source.html:161 +#: source/templates/source.html:170 templates/edit_form.html:6 #: templates/edit_form.html:10 www/templates/news_admin_detail.html:84 msgid "Edit" msgstr "Edit" @@ -70,7 +70,7 @@ msgstr "Edit" #: harvests/templates/external_topic_collection.html:97 #: harvests/templates/harvest_config.html:13 #: harvests/templates/topic_collection.html:107 -#: publishers/templates/publisher.html:35 source/templates/source.html:168 +#: publishers/templates/publisher.html:35 source/templates/source.html:172 #: www/templates/news_admin_detail.html:86 msgid "History" msgstr "History" @@ -152,7 +152,7 @@ msgid "This comment has been removed" msgstr "This comment has been removed" #: comments/models.py:168 qa/models.py:40 qa/templates/detail.html:30 -#: source/models.py:255 source/models.py:535 source/templates/source.html:83 +#: source/models.py:255 source/models.py:537 source/templates/source.html:87 #: templates/history.html:14 msgid "Comment" msgstr "Comment" @@ -162,7 +162,7 @@ msgstr "Comment" #: harvests/templates/harvest.html:110 #: harvests/templates/topic_collection.html:112 #: publishers/templates/publisher.html:39 qa/templates/detail.html:41 -#: source/templates/source.html:200 voting/templates/voting_round.html:118 +#: source/templates/source.html:204 voting/templates/voting_round.html:118 #: www/templates/news_admin_detail.html:90 msgid "Comments" msgstr "Comments" @@ -216,7 +216,7 @@ msgid "Narodni knihovna CR - archivace Vasich webovych stranek" msgstr "National library of the CR - archiving your web sites" #: contracts/models.py:55 contracts/templates/contract.html:21 -#: harvests/models.py:235 harvests/models.py:717 source/models.py:269 +#: harvests/models.py:235 harvests/models.py:716 source/models.py:269 #: voting/models.py:27 msgid "State" msgstr "State" @@ -309,7 +309,7 @@ msgstr "Creative Commons" #: contracts/templates/contract.html:43 publishers/models.py:30 #: source/constants.py:121 source/models.py:244 source/tables.py:10 -#: source/templates/duplicity_check.html:20 source/templates/source.html:72 +#: source/templates/duplicity_check.html:20 source/templates/source.html:76 msgid "Publisher" msgstr "Publisher" @@ -344,7 +344,7 @@ msgstr "Assigned sources" #: contracts/templates/contract.html:113 #: harvests/templates/external_topic_collection.html:95 #: harvests/templates/topic_collection.html:105 -#: publishers/templates/publisher.html:34 source/templates/source.html:165 +#: publishers/templates/publisher.html:34 source/templates/source.html:169 #: www/templates/news_admin_detail.html:83 msgid "Links" msgstr "Links" @@ -355,12 +355,12 @@ msgid "Delete" msgstr "Delete" #: contracts/templates/contract.html:131 source/templates/edit_seed.html:16 -#: source/templates/source.html:210 +#: source/templates/source.html:214 msgid "Proceed with deletion?" msgstr "Proceed with deletion?" #: contracts/templates/contract.html:140 harvests/templates/calendar.html:50 -#: source/templates/edit_seed.html:28 source/templates/source.html:221 +#: source/templates/edit_seed.html:28 source/templates/source.html:225 #: templates/base.html:204 msgid "Close" msgstr "Close" @@ -418,7 +418,7 @@ msgstr "Assign contract" msgid "Contract number assigned." msgstr "Contract number assigned." -#: contracts/views.py:134 source/templates/source.html:189 +#: contracts/views.py:134 source/templates/source.html:193 #: templates/base.html:100 msgid "Contracts" msgstr "Contracts" @@ -571,7 +571,7 @@ msgstr "Planned" msgid "Ready to harvest" msgstr "Ready to harvest" -#: harvests/models.py:209 harvests/models.py:694 +#: harvests/models.py:209 harvests/models.py:693 msgid "Running" msgstr "Running" @@ -591,22 +591,22 @@ msgstr "Cancelled" msgid "Failed" msgstr "Failed" -#: harvests/models.py:237 harvests/models.py:839 +#: harvests/models.py:237 harvests/models.py:838 #: harvests/templates/harvest.html:19 harvests/templates/harvest_config.html:18 msgid "Harvest type" msgstr "Harvest type" -#: harvests/models.py:239 harvests/models.py:603 harvests/models.py:721 -#: harvests/tables.py:76 harvests/tables.py:93 www/tables.py:14 +#: harvests/models.py:239 harvests/models.py:602 harvests/models.py:720 +#: harvests/tables.py:75 harvests/tables.py:92 www/tables.py:13 msgid "title" msgstr "Title" #: harvests/models.py:241 harvests/templates/harvest.html:17 -#: source/models.py:256 source/templates/source.html:87 +#: source/models.py:256 source/templates/source.html:91 msgid "Annotation" msgstr "Annotation" -#: harvests/models.py:243 harvests/models.py:736 +#: harvests/models.py:243 harvests/models.py:735 msgid "Date of harvest" msgstr "Date of harvest" @@ -646,27 +646,27 @@ msgstr "ArchiveIt" msgid "Tests" msgstr "Tests" -#: harvests/models.py:289 harvests/models.py:841 +#: harvests/models.py:289 harvests/models.py:840 #: harvests/templates/harvest.html:65 harvests/templates/harvest_config.html:20 msgid "duration" msgstr "duration" -#: harvests/models.py:291 harvests/models.py:843 +#: harvests/models.py:291 harvests/models.py:842 #: harvests/templates/harvest.html:67 harvests/templates/harvest_config.html:22 msgid "budget" msgstr "budget" -#: harvests/models.py:293 harvests/models.py:845 +#: harvests/models.py:293 harvests/models.py:844 #: harvests/templates/harvest.html:69 harvests/templates/harvest_config.html:24 msgid "dataLimit" msgstr "dataLimit" -#: harvests/models.py:295 harvests/models.py:847 +#: harvests/models.py:295 harvests/models.py:846 #: harvests/templates/harvest.html:71 harvests/templates/harvest_config.html:26 msgid "documentLimit" msgstr "documentLimit" -#: harvests/models.py:297 harvests/models.py:849 +#: harvests/models.py:297 harvests/models.py:848 #: harvests/templates/harvest.html:73 harvests/templates/harvest_config.html:28 msgid "deduplication" msgstr "deduplication" @@ -675,86 +675,86 @@ msgstr "deduplication" msgid "Seeds not harvested" msgstr "Seeds not harvested" -#: harvests/models.py:607 harvests/models.py:724 source/constants.py:124 +#: harvests/models.py:606 harvests/models.py:723 source/constants.py:124 #: source/models.py:240 msgid "Curator" msgstr "Curator" -#: harvests/models.py:611 source/templates/source.html:91 +#: harvests/models.py:610 source/templates/source.html:95 msgid "keywords" msgstr "Keywords" -#: harvests/models.py:614 harvests/models.py:741 +#: harvests/models.py:613 harvests/models.py:740 msgid "annotation" msgstr "annotation" -#: harvests/models.py:618 +#: harvests/models.py:617 msgid "image" msgstr "image" -#: harvests/models.py:677 harvests/templates/topic_collection.html:13 +#: harvests/models.py:676 harvests/templates/topic_collection.html:13 msgid "External Topic Collection" msgstr "External Topic Collection" -#: harvests/models.py:678 templates/base.html:110 +#: harvests/models.py:677 templates/base.html:110 msgid "External Topic Collections" msgstr "External Topic Collections" -#: harvests/models.py:695 +#: harvests/models.py:694 msgid "New" msgstr "New" -#: harvests/models.py:696 +#: harvests/models.py:695 msgid "Finished" msgstr "Finished" -#: harvests/models.py:708 harvests/templates/topic_collection.html:49 -#: source/models.py:275 source/templates/source.html:56 templates/api.html:17 +#: harvests/models.py:707 harvests/templates/topic_collection.html:49 +#: source/models.py:275 source/templates/source.html:60 templates/api.html:17 msgid "Frequency" msgstr "Frequency" -#: harvests/models.py:745 +#: harvests/models.py:744 msgid "All sources are under open license or contract" msgstr "All sources are under open license or contract" -#: harvests/models.py:748 +#: harvests/models.py:747 msgid "Date from" msgstr "Date from" -#: harvests/models.py:749 +#: harvests/models.py:748 msgid "Date to" msgstr "Date to" -#: harvests/models.py:753 harvests/templates/topic_collection.html:24 +#: harvests/models.py:752 harvests/templates/topic_collection.html:24 msgid "Collection alias" msgstr "Collection alias" -#: harvests/models.py:755 harvests/templates/topic_collection.html:82 +#: harvests/models.py:754 harvests/templates/topic_collection.html:82 msgid "Aggregation with same type" msgstr "Aggregation with same type" -#: harvests/models.py:811 +#: harvests/models.py:810 msgid "Internal Topic Collection" msgstr "Internal Topic Collection" -#: harvests/models.py:812 harvests/templates/external_topic_collection.html:82 +#: harvests/models.py:811 harvests/templates/external_topic_collection.html:82 #: templates/base.html:113 msgid "Internal Topic Collections" msgstr "Internal Topic Collections" -#: harvests/models.py:818 +#: harvests/models.py:817 msgid "file" msgstr "file" -#: harvests/models.py:852 +#: harvests/models.py:851 msgid "Harvest Configuration" msgstr "Harvest Configuration" -#: harvests/models.py:853 harvests/views.py:399 templates/base.html:127 +#: harvests/models.py:852 harvests/views.py:399 templates/base.html:127 msgid "Harvest Configurations" msgstr "Harvest Configurations" -#: harvests/models.py:857 +#: harvests/models.py:856 #, python-format msgid "Configuration for %(type)s Harvests" msgstr "Configuration for %(type)s Harvests" @@ -824,13 +824,13 @@ msgid "Screenshot" msgstr "Screenshot" #: harvests/templates/external_topic_collection.html:51 -#: harvests/templates/topic_collection.html:65 source/templates/source.html:64 +#: harvests/templates/topic_collection.html:65 source/templates/source.html:68 #: www/templates/news_admin_detail.html:76 msgid "Created at" msgstr "Created at" #: harvests/templates/external_topic_collection.html:55 -#: harvests/templates/topic_collection.html:69 source/templates/source.html:52 +#: harvests/templates/topic_collection.html:69 source/templates/source.html:56 msgid "Owner" msgstr "Owner" @@ -839,7 +839,7 @@ msgid "Keywords" msgstr "Keywords" #: harvests/templates/external_topic_collection.html:66 -#: source/templates/source.html:130 +#: source/templates/source.html:134 msgid "WWW link" msgstr "WWW link" @@ -949,7 +949,7 @@ msgid "All sources are open?" msgstr "All sources are open?" #: harvests/templates/topic_collection.html:94 qa/templates/qa_form.html:20 -#: source/models.py:564 source/templates/source.html:152 +#: source/models.py:566 source/templates/source.html:156 msgid "Seeds" msgstr "Seeds" @@ -1071,7 +1071,7 @@ msgstr "Phone" msgid "Address" msgstr "Address" -#: publishers/models.py:65 source/templates/source.html:76 +#: publishers/models.py:65 source/templates/source.html:80 msgid "Publisher contact" msgstr "Publisher contact" @@ -1087,7 +1087,7 @@ msgstr "Contacts:" msgid "Edit contacts" msgstr "Edit contacts" -#: publishers/templates/publisher.html:24 source/models.py:307 +#: publishers/templates/publisher.html:24 source/models.py:308 #: source/views.py:254 templates/base.html:94 msgid "Sources" msgstr "Sources" @@ -1096,7 +1096,7 @@ msgstr "Sources" msgid "Add publisher" msgstr "Add publisher" -#: qa/models.py:18 qa/templates/detail.html:13 source/models.py:306 +#: qa/models.py:18 qa/templates/detail.html:13 source/models.py:307 msgid "Source" msgstr "Source" @@ -1252,7 +1252,7 @@ msgstr "Seed is no longer published" msgid "Visitor" msgstr "Visitor" -#: source/constants.py:123 source/templates/source.html:110 +#: source/constants.py:123 source/templates/source.html:114 msgid "ISSN" msgstr "ISSN" @@ -1288,15 +1288,15 @@ msgstr "" "Sources with status 'Archiving accepted' and 'Archiving without publisher " "consent' must have a selected Harvest Frequency" -#: source/models.py:259 source/templates/source.html:68 +#: source/models.py:259 source/templates/source.html:72 msgid "Suggested by" msgstr "Suggested by" -#: source/models.py:280 source/templates/source.html:98 +#: source/models.py:280 source/templates/source.html:102 msgid "Category" msgstr "Category" -#: source/models.py:285 source/templates/source.html:102 +#: source/models.py:285 source/templates/source.html:106 msgid "Sub category" msgstr "Sub category" @@ -1304,63 +1304,67 @@ msgstr "Sub category" msgid "Source is dead" msgstr "Source is dead" -#: source/models.py:516 +#: source/models.py:298 source/templates/source.html:52 +msgid "Priority source" +msgstr "Priority source" + +#: source/models.py:518 msgid "default" msgstr "default" -#: source/models.py:517 +#: source/models.py:519 msgid "low" msgstr "low" -#: source/models.py:518 +#: source/models.py:520 msgid "very_low" msgstr "very_low" -#: source/models.py:529 +#: source/models.py:531 msgid "Main seed" msgstr "Main seed" -#: source/models.py:530 +#: source/models.py:532 msgid "Seed url" msgstr "Seed URL" -#: source/models.py:536 +#: source/models.py:538 msgid "From" msgstr "From" -#: source/models.py:537 +#: source/models.py:539 msgid "To" msgstr "To" -#: source/models.py:540 +#: source/models.py:542 msgid "Javascript" msgstr "Javascript" -#: source/models.py:541 +#: source/models.py:543 msgid "Global reject" msgstr "Global reject" -#: source/models.py:542 +#: source/models.py:544 msgid "Youtube" msgstr "YouTube" -#: source/models.py:543 +#: source/models.py:545 msgid "Calendars" msgstr "Calendars" -#: source/models.py:544 +#: source/models.py:546 msgid "Local traps" msgstr "Local traps" -#: source/models.py:545 +#: source/models.py:547 msgid "Redirect on seed" msgstr "Redirect on seed" -#: source/models.py:546 +#: source/models.py:548 msgid "Robots.txt active" msgstr "Robots.txt active" -#: source/models.py:563 +#: source/models.py:565 msgid "Seed" msgstr "Seed" @@ -1392,67 +1396,67 @@ msgstr "" msgid "Dead" msgstr "Dead" -#: source/templates/source.html:60 +#: source/templates/source.html:64 msgid "Created by" msgstr "Created by" -#: source/templates/source.html:106 +#: source/templates/source.html:110 msgid "Aleph id" msgstr "Aleph ID" -#: source/templates/source.html:114 +#: source/templates/source.html:118 msgid "QA checks" msgstr "QA checks" -#: source/templates/source.html:124 +#: source/templates/source.html:128 msgid "WA-admin link" msgstr "WA-admin link" -#: source/templates/source.html:125 +#: source/templates/source.html:129 msgid "Legacy url" msgstr "Legacy URL" -#: source/templates/source.html:143 +#: source/templates/source.html:147 msgid "No" msgstr "No" -#: source/templates/source.html:161 +#: source/templates/source.html:165 msgid "Add seeds" msgstr "Add seeds" -#: source/templates/source.html:167 +#: source/templates/source.html:171 msgid "WA-KAT" msgstr "WA-KAT" -#: source/templates/source.html:169 +#: source/templates/source.html:173 msgid "QA check" msgstr "QA check" -#: source/templates/source.html:174 source/templates/source.html:217 +#: source/templates/source.html:178 source/templates/source.html:221 msgid "Deactivate" msgstr "Deactivate" -#: source/templates/source.html:179 +#: source/templates/source.html:183 msgid "Voting rounds" msgstr "Voting rounds" -#: source/templates/source.html:182 +#: source/templates/source.html:186 msgid "Create voting round" msgstr "Create voting round" -#: source/templates/source.html:193 +#: source/templates/source.html:197 msgid "Sorry no contracts yet." msgstr "Sorry no contracts yet." -#: source/templates/source.html:195 +#: source/templates/source.html:199 msgid "Create" msgstr "Create" -#: source/templates/source.html:196 +#: source/templates/source.html:200 msgid "Assign" msgstr "Assign" -#: source/templates/source.html:213 +#: source/templates/source.html:217 msgid "If you proceed it will be very hard to reactivate this source." msgstr "If you proceed it will be very hard to reactivate this source." diff --git a/Seeder/source/field_filters.py b/Seeder/source/field_filters.py index 795cd618..99510c89 100755 --- a/Seeder/source/field_filters.py +++ b/Seeder/source/field_filters.py @@ -76,6 +76,7 @@ class Meta: 'sub_category': ('exact',), 'suggested_by': ('exact',), 'dead_source': ('exact',), + 'priority_source': ('exact',), 'created': ('exact',), 'last_changed': ('exact',), 'issn': ('contains',), diff --git a/Seeder/source/forms.py b/Seeder/source/forms.py index b03c473b..163fc652 100755 --- a/Seeder/source/forms.py +++ b/Seeder/source/forms.py @@ -73,7 +73,8 @@ class Meta: model = models.Source fields = ('owner', 'name', 'publisher', 'publisher_contact', 'state', 'frequency', 'keywords', 'category', 'sub_category', 'annotation', - 'screenshot', 'comment', 'aleph_id', 'issn', 'dead_source') + 'screenshot', 'comment', 'aleph_id', 'issn', + 'dead_source', 'priority_source') widgets = { 'publisher': autocomplete.ModelSelect2( diff --git a/Seeder/source/migrations/0008_source_priority_source.py b/Seeder/source/migrations/0008_source_priority_source.py new file mode 100644 index 00000000..21fdd283 --- /dev/null +++ b/Seeder/source/migrations/0008_source_priority_source.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.28 on 2024-12-15 15:16 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('source', '0007_strip_seed_urls_20240718_0951'), + ] + + operations = [ + migrations.AddField( + model_name='source', + name='priority_source', + field=models.BooleanField(default=False, verbose_name='Priority source'), + ), + ] diff --git a/Seeder/source/models.py b/Seeder/source/models.py index d8e1f3f7..a9041246 100755 --- a/Seeder/source/models.py +++ b/Seeder/source/models.py @@ -295,6 +295,7 @@ class Source(SearchModel, SlugOrCreateModel, BaseModel): screenshot_date = models.DateTimeField(null=True, blank=True) keywords = models.ManyToManyField(KeyWord, blank=True) dead_source = models.BooleanField(_('Source is dead'), default=False) + priority_source = models.BooleanField(_('Priority source'), default=False) slug = models.SlugField(unique=True, blank=True, null=True) from_field = 'stripped_main_url' @@ -494,7 +495,8 @@ def export_all_sources(cls): df = pd.DataFrame.from_records(qs.values( "id", "name", "owner__username", "state", "publisher__name", "category__name", "sub_category__name", "suggested_by", - "dead_source", "created", "last_changed", "seed_urls", + "dead_source", "priority_source", "created", "last_changed", + "seed_urls", )) for col in df.columns: # Make datetime fields timezone-naive diff --git a/Seeder/source/tables.py b/Seeder/source/tables.py index ed18165e..fc9ae41c 100755 --- a/Seeder/source/tables.py +++ b/Seeder/source/tables.py @@ -29,8 +29,8 @@ def render_urls(self, record, value): class Meta: model = models.Source fields = ('name', 'owner', 'state', 'publisher', 'category', - 'sub_category', 'suggested_by', 'dead_source', - 'created', 'last_changed', 'urls') + 'sub_category', 'suggested_by', 'dead_source', + 'priority_source', 'created', 'last_changed', 'urls') attrs = { 'class': 'table table-striped table-hover' } diff --git a/Seeder/source/templates/source.html b/Seeder/source/templates/source.html index 72e02f4e..d66af927 100755 --- a/Seeder/source/templates/source.html +++ b/Seeder/source/templates/source.html @@ -48,6 +48,10 @@

    {% trans 'Info' %}

    {% trans 'Dead' %} {{ source.dead_source|fa_boolean }} + + {% trans 'Priority source' %} + {{ source.priority_source|fa_boolean }} + {% trans 'Owner' %} {{ source.owner.get_full_name }} From 8fba7ff50d62829d864e21c0178a5192cbfb89cc Mon Sep 17 00:00:00 2001 From: Fasand Date: Sun, 15 Dec 2024 17:04:39 +0100 Subject: [PATCH 7/8] #701: add a 'Unassign contract' workflow to Source, available to superusers --- Seeder/contracts/urls.py | 1 + Seeder/contracts/views.py | 40 +++++++++++++++++- Seeder/locale/cs/LC_MESSAGES/django.po | 51 +++++++++++++++-------- Seeder/locale/en_US/LC_MESSAGES/django.po | 51 +++++++++++++++-------- Seeder/source/templates/source.html | 3 ++ 5 files changed, 111 insertions(+), 35 deletions(-) diff --git a/Seeder/contracts/urls.py b/Seeder/contracts/urls.py index 6260ddd3..dc312a5e 100644 --- a/Seeder/contracts/urls.py +++ b/Seeder/contracts/urls.py @@ -6,6 +6,7 @@ path('autocomplete', ContractAutocomplete.as_view(), name='autocomplete'), path('/create', Create.as_view(), name='create'), path('/assign', Assign.as_view(), name='assign'), + path('/unassign', Unassign.as_view(), name='unassign'), path('/edit', Edit.as_view(), name='edit'), path('/history', History.as_view(), name='history'), path('', ListView.as_view(), name='list'), diff --git a/Seeder/contracts/views.py b/Seeder/contracts/views.py index 659dfee9..7447e86e 100755 --- a/Seeder/contracts/views.py +++ b/Seeder/contracts/views.py @@ -41,7 +41,8 @@ def get_queryset(self): return models.Contract.objects.none() # Annotate as strings so we can use icontains qs = models.Contract.objects.all().annotate( - contract_number_s=Cast("contract_number", output_field=CharField()), + contract_number_s=Cast( + "contract_number", output_field=CharField()), year_s=Cast("year", output_field=CharField()) ).order_by("contract_number", "year") # Allow searching by "{contract_number} / {year}" @@ -108,6 +109,43 @@ def form_valid(self, form): return HttpResponseRedirect(contract.get_absolute_url()) +class Unassign(LoginMixin, FormView, MessageView, ObjectMixinFixed): + """ + Unassign a contract from source + Defined with Source as the model to stay consistent with Assign + """ + form_class = forms.AssignForm + template_name = "add_form.html" + title = _("Unassign contract") + view_name = "contracts" + model = Source + + def get_form(self, form_class=None): + """ Retrieve all of Source's assigned contracts """ + form = super().get_form(form_class) + contract = form.fields['contract'] + contract.queryset = self.get_object().contract_set.all() + if not contract.queryset.exists(): + self.add_message(self.request, messages.ERROR, _( + "The source doesn't have any contracts assigned.")) + contract.disabled = True + return form + + def form_valid(self, form): + """ Remove selected contract and change Source state if necessary """ + contract = form.cleaned_data['contract'] + contract.sources.remove(self.object) + # If no assigned contracts remain, update the state + if self.object.contract_set.count() == 0: + self.add_message(_("All contracts have been unassigned so the " + "source state was changed to '%(state)s'") % { + "state": _('Archiving without publisher consent')}, + level=messages.WARNING) + self.object.state = source_constants.STATE_WITHOUT_PUBLISHER + self.object.save() + return HttpResponseRedirect(self.object.get_absolute_url()) + + class Edit(ContractView, EditView): form_class = forms.ContractForm diff --git a/Seeder/locale/cs/LC_MESSAGES/django.po b/Seeder/locale/cs/LC_MESSAGES/django.po index 6a32a140..6f4868ec 100644 --- a/Seeder/locale/cs/LC_MESSAGES/django.po +++ b/Seeder/locale/cs/LC_MESSAGES/django.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Seeder\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-15 15:19+0000\n" +"POT-Creation-Date: 2024-12-15 15:59+0000\n" "PO-Revision-Date: 2018-04-16 13:40+0200\n" "Last-Translator: mariehaskovcova , 2017\n" "Language-Team: Czech (https://www.transifex.com/webarchivecz/teams/43032/" @@ -161,7 +161,7 @@ msgstr "Komentář" #: harvests/templates/harvest.html:110 #: harvests/templates/topic_collection.html:112 #: publishers/templates/publisher.html:39 qa/templates/detail.html:41 -#: source/templates/source.html:204 voting/templates/voting_round.html:118 +#: source/templates/source.html:207 voting/templates/voting_round.html:118 #: www/templates/news_admin_detail.html:90 msgid "Comments" msgstr "Komentáře" @@ -354,12 +354,12 @@ msgid "Delete" msgstr "Smazat" #: contracts/templates/contract.html:131 source/templates/edit_seed.html:16 -#: source/templates/source.html:214 +#: source/templates/source.html:217 msgid "Proceed with deletion?" msgstr "Pokračovat se smazáním?" #: contracts/templates/contract.html:140 harvests/templates/calendar.html:50 -#: source/templates/edit_seed.html:28 source/templates/source.html:225 +#: source/templates/edit_seed.html:28 source/templates/source.html:228 #: templates/base.html:204 msgid "Close" msgstr "Zavřít" @@ -403,32 +403,53 @@ msgstr "" msgid "Send" msgstr "Odeslat" -#: contracts/views.py:64 +#: contracts/views.py:65 msgid "Add contract" msgstr "Přidat smlouvu" -#: contracts/views.py:86 +#: contracts/views.py:87 msgid "Assign contract" msgstr "Přiřadit smlouvu" -#: contracts/views.py:120 +#: contracts/views.py:119 source/templates/source.html:202 +msgid "Unassign contract" +msgstr "Odpojit smlouvu" + +#: contracts/views.py:130 +msgid "The source doesn't have any contracts assigned." +msgstr "Zdroj nemá přiřazené žádné smlouvy" + +#: contracts/views.py:140 +#, python-format +msgid "" +"All contracts have been unassigned so the source state was changed to " +"'%(state)s'" +msgstr "" +"Všechny smlouvy byly odpojeny, stav zdroje byl tedy nastaven na " +"'%(state)s'" + +#: contracts/views.py:142 source/constants.py:29 +msgid "Archiving without publisher consent" +msgstr "Archivován bez smlouvy" + +#: contracts/views.py:158 msgid "Contract number assigned." msgstr "Smlouvě bylo přiřazeno číslo." -#: contracts/views.py:134 source/templates/source.html:193 +#: contracts/views.py:172 source/templates/source.html:193 #: templates/base.html:100 msgid "Contracts" msgstr "Smlouvy" -#: contracts/views.py:141 +#: contracts/views.py:179 msgid "Schedule emails" msgstr "Naplánování e-mailů" -#: contracts/views.py:207 +#: contracts/views.py:245 msgid "Can't delete contract with number" msgstr "Nelze smazat smlouvu s číslem" -#: contracts/views.py:215 +#: contracts/views.py:253 msgid "Contract deleted." msgstr "Smlouva smazána" @@ -1185,10 +1206,6 @@ msgstr "Odmítnuto Webarchivem" msgid "Archiving accepted" msgstr "Archivován" -#: source/constants.py:29 -msgid "Archiving without publisher consent" -msgstr "Archivován bez smlouvy" - #: source/constants.py:30 msgid "Declined by publisher" msgstr "Odmítnuto vydavatelem" @@ -1427,7 +1444,7 @@ msgstr "WA-KAT" msgid "QA check" msgstr "Provedení kontroly kvality" -#: source/templates/source.html:178 source/templates/source.html:221 +#: source/templates/source.html:178 source/templates/source.html:224 msgid "Deactivate" msgstr "Deaktivovat" @@ -1451,7 +1468,7 @@ msgstr "Vytvořit" msgid "Assign" msgstr "Přiřadit" -#: source/templates/source.html:217 +#: source/templates/source.html:220 msgid "If you proceed it will be very hard to reactivate this source." msgstr "Pokud budete pokračovat, bude velmi těžké zdroj znovu aktivovat." diff --git a/Seeder/locale/en_US/LC_MESSAGES/django.po b/Seeder/locale/en_US/LC_MESSAGES/django.po index 60829993..6568570f 100644 --- a/Seeder/locale/en_US/LC_MESSAGES/django.po +++ b/Seeder/locale/en_US/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Seeder\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-15 15:19+0000\n" +"POT-Creation-Date: 2024-12-15 15:59+0000\n" "PO-Revision-Date: 2017-11-07 12:38+0100\n" "Last-Translator: Visgean Skeloru , 2017\n" "Language-Team: English (United States) (https://www.transifex.com/" @@ -162,7 +162,7 @@ msgstr "Comment" #: harvests/templates/harvest.html:110 #: harvests/templates/topic_collection.html:112 #: publishers/templates/publisher.html:39 qa/templates/detail.html:41 -#: source/templates/source.html:204 voting/templates/voting_round.html:118 +#: source/templates/source.html:207 voting/templates/voting_round.html:118 #: www/templates/news_admin_detail.html:90 msgid "Comments" msgstr "Comments" @@ -355,12 +355,12 @@ msgid "Delete" msgstr "Delete" #: contracts/templates/contract.html:131 source/templates/edit_seed.html:16 -#: source/templates/source.html:214 +#: source/templates/source.html:217 msgid "Proceed with deletion?" msgstr "Proceed with deletion?" #: contracts/templates/contract.html:140 harvests/templates/calendar.html:50 -#: source/templates/edit_seed.html:28 source/templates/source.html:225 +#: source/templates/edit_seed.html:28 source/templates/source.html:228 #: templates/base.html:204 msgid "Close" msgstr "Close" @@ -406,32 +406,53 @@ msgstr "" msgid "Send" msgstr "Send" -#: contracts/views.py:64 +#: contracts/views.py:65 msgid "Add contract" msgstr "Add contract" -#: contracts/views.py:86 +#: contracts/views.py:87 msgid "Assign contract" msgstr "Assign contract" -#: contracts/views.py:120 +#: contracts/views.py:119 source/templates/source.html:202 +msgid "Unassign contract" +msgstr "Unassign contract" + +#: contracts/views.py:130 +msgid "The source doesn't have any contracts assigned." +msgstr "The source doesn't have any contracts assigned." + +#: contracts/views.py:140 +#, python-format +msgid "" +"All contracts have been unassigned so the source state was changed to " +"'%(state)s'" +msgstr "" +"All contracts have been unassigned so the source state was changed to " +"'%(state)s'" + +#: contracts/views.py:142 source/constants.py:29 +msgid "Archiving without publisher consent" +msgstr "Archiving without publisher consent" + +#: contracts/views.py:158 msgid "Contract number assigned." msgstr "Contract number assigned." -#: contracts/views.py:134 source/templates/source.html:193 +#: contracts/views.py:172 source/templates/source.html:193 #: templates/base.html:100 msgid "Contracts" msgstr "Contracts" -#: contracts/views.py:141 +#: contracts/views.py:179 msgid "Schedule emails" msgstr "Schedule e-mails" -#: contracts/views.py:207 +#: contracts/views.py:245 msgid "Can't delete contract with number" msgstr "Can't delete contract with number" -#: contracts/views.py:215 +#: contracts/views.py:253 msgid "Contract deleted." msgstr "Contract deleted." @@ -1188,10 +1209,6 @@ msgstr "Declined by staff" msgid "Archiving accepted" msgstr "Archiving accepted" -#: source/constants.py:29 -msgid "Archiving without publisher consent" -msgstr "Archiving without publisher consent" - #: source/constants.py:30 msgid "Declined by publisher" msgstr "Declined by publisher" @@ -1432,7 +1449,7 @@ msgstr "WA-KAT" msgid "QA check" msgstr "QA check" -#: source/templates/source.html:178 source/templates/source.html:221 +#: source/templates/source.html:178 source/templates/source.html:224 msgid "Deactivate" msgstr "Deactivate" @@ -1456,7 +1473,7 @@ msgstr "Create" msgid "Assign" msgstr "Assign" -#: source/templates/source.html:217 +#: source/templates/source.html:220 msgid "If you proceed it will be very hard to reactivate this source." msgstr "If you proceed it will be very hard to reactivate this source." diff --git a/Seeder/source/templates/source.html b/Seeder/source/templates/source.html index d66af927..f67a61d7 100755 --- a/Seeder/source/templates/source.html +++ b/Seeder/source/templates/source.html @@ -198,6 +198,9 @@

    {% trans 'Contracts' %}:

    {% endfor %} {% trans 'Create' %} {% trans 'Assign' %} + {% if source.contract_set.exists and request.user.is_superuser %} + {% trans 'Unassign contract' %} + {% endif %}
    From 089fa1a953415c2cd0d020c167edc44f6e7a7680 Mon Sep 17 00:00:00 2001 From: Fasand Date: Sun, 15 Dec 2024 17:48:55 +0100 Subject: [PATCH 8/8] =?UTF-8?q?#695:=20improve=20Publisher=20Contact=20edi?= =?UTF-8?q?t=20=E2=80=93=20if=20trying=20to=20delete=20a=20connected=20con?= =?UTF-8?q?tact,=20get=20an=20error=20message=20with=20links=20to=20linked?= =?UTF-8?q?=20records?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Seeder/locale/cs/LC_MESSAGES/django.po | 80 ++++++++++--------- Seeder/locale/en_US/LC_MESSAGES/django.po | 77 ++++++++++-------- Seeder/publishers/views.py | 16 +++- .../migrations/0009_auto_20241215_1640.py | 19 +++++ Seeder/source/models.py | 3 +- 5 files changed, 123 insertions(+), 72 deletions(-) create mode 100644 Seeder/source/migrations/0009_auto_20241215_1640.py diff --git a/Seeder/locale/cs/LC_MESSAGES/django.po b/Seeder/locale/cs/LC_MESSAGES/django.po index 6f4868ec..71c7699c 100644 --- a/Seeder/locale/cs/LC_MESSAGES/django.po +++ b/Seeder/locale/cs/LC_MESSAGES/django.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Seeder\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-15 15:59+0000\n" +"POT-Creation-Date: 2024-12-15 16:40+0000\n" "PO-Revision-Date: 2018-04-16 13:40+0200\n" "Last-Translator: mariehaskovcova , 2017\n" "Language-Team: Czech (https://www.transifex.com/webarchivecz/teams/43032/" @@ -151,7 +151,7 @@ msgid "This comment has been removed" msgstr "Komentář byl odstraněn" #: comments/models.py:168 qa/models.py:40 qa/templates/detail.html:30 -#: source/models.py:255 source/models.py:537 source/templates/source.html:87 +#: source/models.py:256 source/models.py:538 source/templates/source.html:87 #: templates/history.html:14 msgid "Comment" msgstr "Komentář" @@ -215,7 +215,7 @@ msgid "Narodni knihovna CR - archivace Vasich webovych stranek" msgstr "Narodni knihovna CR - archivace Vasich webovych stranek" #: contracts/models.py:55 contracts/templates/contract.html:21 -#: harvests/models.py:235 harvests/models.py:716 source/models.py:269 +#: harvests/models.py:235 harvests/models.py:716 source/models.py:270 #: voting/models.py:27 msgid "State" msgstr "Stav" @@ -425,8 +425,7 @@ msgid "" "All contracts have been unassigned so the source state was changed to " "'%(state)s'" msgstr "" -"Všechny smlouvy byly odpojeny, stav zdroje byl tedy nastaven na " -"'%(state)s'" +"Všechny smlouvy byly odpojeny, stav zdroje byl tedy nastaven na '%(state)s'" #: contracts/views.py:142 source/constants.py:29 msgid "Archiving without publisher consent" @@ -620,7 +619,7 @@ msgid "title" msgstr "Název" #: harvests/models.py:241 harvests/templates/harvest.html:17 -#: source/models.py:256 source/templates/source.html:91 +#: source/models.py:257 source/templates/source.html:91 msgid "Annotation" msgstr "Anotace" @@ -727,7 +726,7 @@ msgid "Finished" msgstr "Hotovo" #: harvests/models.py:707 harvests/templates/topic_collection.html:49 -#: source/models.py:275 source/templates/source.html:60 templates/api.html:17 +#: source/models.py:276 source/templates/source.html:60 templates/api.html:17 msgid "Frequency" msgstr "Frekvence" @@ -836,7 +835,7 @@ msgstr "anotace (ČJ)" msgid "annotation [en]" msgstr "anotace (AJ)" -#: harvests/templates/external_topic_collection.html:39 source/models.py:290 +#: harvests/templates/external_topic_collection.html:39 source/models.py:291 #: source/templates/source.html:32 msgid "Screenshot" msgstr "Screenshot" @@ -967,7 +966,7 @@ msgid "All sources are open?" msgstr "Všechny zdroje jsou otevřené?" #: harvests/templates/topic_collection.html:94 qa/templates/qa_form.html:20 -#: source/models.py:566 source/templates/source.html:156 +#: source/models.py:567 source/templates/source.html:156 msgid "Seeds" msgstr "Semínka" @@ -1056,7 +1055,7 @@ msgid "Position" msgstr "Pozice" #: publishers/forms.py:57 publishers/models.py:24 publishers/models.py:57 -#: publishers/tables.py:9 source/models.py:254 source/tables.py:8 +#: publishers/tables.py:9 source/models.py:255 source/tables.py:8 #: www/models.py:82 msgid "Name" msgstr "Jméno" @@ -1073,7 +1072,7 @@ msgstr "Nemůžete použít již existující kontakt a zároveň vytvářet nov msgid "Please fill-out the email" msgstr "Vyplňte email" -#: publishers/models.py:31 publishers/views.py:43 templates/base.html:97 +#: publishers/models.py:31 publishers/views.py:45 templates/base.html:97 msgid "Publishers" msgstr "Vydavatelé" @@ -1089,7 +1088,7 @@ msgstr "Telefon" msgid "Address" msgstr "Adresa" -#: publishers/models.py:65 source/templates/source.html:80 +#: publishers/models.py:65 source/models.py:250 source/templates/source.html:80 msgid "Publisher contact" msgstr "Kontakt na vydavatele" @@ -1101,20 +1100,29 @@ msgstr "Kontakty na vydavatele" msgid "Contacts:" msgstr "Kontakty:" -#: publishers/templates/publisher.html:20 publishers/views.py:53 +#: publishers/templates/publisher.html:20 publishers/views.py:55 msgid "Edit contacts" msgstr "Editovat kontakty" -#: publishers/templates/publisher.html:24 source/models.py:308 +#: publishers/templates/publisher.html:24 source/models.py:309 #: source/views.py:254 templates/base.html:94 msgid "Sources" msgstr "Zdroje" -#: publishers/views.py:20 source/views.py:80 +#: publishers/views.py:22 source/views.py:80 msgid "Add publisher" msgstr "Přidat vydavatele" -#: qa/models.py:18 qa/templates/detail.html:13 source/models.py:307 +#: publishers/views.py:71 +#, python-format +msgid "" +"Contact person %(person)s is still set as contact on: %(sources)s, please " +"remove them there first." +msgstr "" +"Kontaktní osoba %(person)s je stále nastavena jako kontakt na: %(sources)s, " +"nejdříve je tam prosím odeberte." + +#: qa/models.py:18 qa/templates/detail.html:13 source/models.py:308 msgid "Source" msgstr "Zdroj" @@ -1302,83 +1310,83 @@ msgstr "" "Zdroje se stavem 'Archivován' a 'Archivován bez smlouvy' musí mít vybranou " "Frekvenci sklízení" -#: source/models.py:259 source/templates/source.html:72 +#: source/models.py:260 source/templates/source.html:72 msgid "Suggested by" msgstr "Navrženo" -#: source/models.py:280 source/templates/source.html:102 +#: source/models.py:281 source/templates/source.html:102 msgid "Category" msgstr "Kategorie" -#: source/models.py:285 source/templates/source.html:106 +#: source/models.py:286 source/templates/source.html:106 msgid "Sub category" msgstr "Podkategorie" -#: source/models.py:297 +#: source/models.py:298 msgid "Source is dead" msgstr "Mrtvý web" -#: source/models.py:298 source/templates/source.html:52 +#: source/models.py:299 source/templates/source.html:52 msgid "Priority source" msgstr "Prioritní zdroj" -#: source/models.py:518 +#: source/models.py:519 msgid "default" msgstr "výchozí" -#: source/models.py:519 +#: source/models.py:520 msgid "low" msgstr "low" -#: source/models.py:520 +#: source/models.py:521 msgid "very_low" msgstr "very low" -#: source/models.py:531 +#: source/models.py:532 msgid "Main seed" msgstr "Hlavní semínko" -#: source/models.py:532 +#: source/models.py:533 msgid "Seed url" msgstr "URL semínko" -#: source/models.py:538 +#: source/models.py:539 msgid "From" msgstr "Od" -#: source/models.py:539 +#: source/models.py:540 msgid "To" msgstr "Do" -#: source/models.py:542 +#: source/models.py:543 msgid "Javascript" msgstr "Javascript" -#: source/models.py:543 +#: source/models.py:544 msgid "Global reject" msgstr "Odmítnuto" -#: source/models.py:544 +#: source/models.py:545 msgid "Youtube" msgstr "Youtube" -#: source/models.py:545 +#: source/models.py:546 msgid "Calendars" msgstr "Kalendáře" -#: source/models.py:546 +#: source/models.py:547 msgid "Local traps" msgstr "Local traps" -#: source/models.py:547 +#: source/models.py:548 msgid "Redirect on seed" msgstr "Přesměrováno na semínko" -#: source/models.py:548 +#: source/models.py:549 msgid "Robots.txt active" msgstr "aktivní Robots.txt" -#: source/models.py:565 +#: source/models.py:566 msgid "Seed" msgstr "Semínko" diff --git a/Seeder/locale/en_US/LC_MESSAGES/django.po b/Seeder/locale/en_US/LC_MESSAGES/django.po index 6568570f..bc1cf06b 100644 --- a/Seeder/locale/en_US/LC_MESSAGES/django.po +++ b/Seeder/locale/en_US/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Seeder\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-15 15:59+0000\n" +"POT-Creation-Date: 2024-12-15 16:40+0000\n" "PO-Revision-Date: 2017-11-07 12:38+0100\n" "Last-Translator: Visgean Skeloru , 2017\n" "Language-Team: English (United States) (https://www.transifex.com/" @@ -152,7 +152,7 @@ msgid "This comment has been removed" msgstr "This comment has been removed" #: comments/models.py:168 qa/models.py:40 qa/templates/detail.html:30 -#: source/models.py:255 source/models.py:537 source/templates/source.html:87 +#: source/models.py:256 source/models.py:538 source/templates/source.html:87 #: templates/history.html:14 msgid "Comment" msgstr "Comment" @@ -216,7 +216,7 @@ msgid "Narodni knihovna CR - archivace Vasich webovych stranek" msgstr "National library of the CR - archiving your web sites" #: contracts/models.py:55 contracts/templates/contract.html:21 -#: harvests/models.py:235 harvests/models.py:716 source/models.py:269 +#: harvests/models.py:235 harvests/models.py:716 source/models.py:270 #: voting/models.py:27 msgid "State" msgstr "State" @@ -623,7 +623,7 @@ msgid "title" msgstr "Title" #: harvests/models.py:241 harvests/templates/harvest.html:17 -#: source/models.py:256 source/templates/source.html:91 +#: source/models.py:257 source/templates/source.html:91 msgid "Annotation" msgstr "Annotation" @@ -730,7 +730,7 @@ msgid "Finished" msgstr "Finished" #: harvests/models.py:707 harvests/templates/topic_collection.html:49 -#: source/models.py:275 source/templates/source.html:60 templates/api.html:17 +#: source/models.py:276 source/templates/source.html:60 templates/api.html:17 msgid "Frequency" msgstr "Frequency" @@ -839,7 +839,7 @@ msgstr "annotation [cs]" msgid "annotation [en]" msgstr "annotation [en]" -#: harvests/templates/external_topic_collection.html:39 source/models.py:290 +#: harvests/templates/external_topic_collection.html:39 source/models.py:291 #: source/templates/source.html:32 msgid "Screenshot" msgstr "Screenshot" @@ -970,7 +970,7 @@ msgid "All sources are open?" msgstr "All sources are open?" #: harvests/templates/topic_collection.html:94 qa/templates/qa_form.html:20 -#: source/models.py:566 source/templates/source.html:156 +#: source/models.py:567 source/templates/source.html:156 msgid "Seeds" msgstr "Seeds" @@ -1059,7 +1059,7 @@ msgid "Position" msgstr "Position" #: publishers/forms.py:57 publishers/models.py:24 publishers/models.py:57 -#: publishers/tables.py:9 source/models.py:254 source/tables.py:8 +#: publishers/tables.py:9 source/models.py:255 source/tables.py:8 #: www/models.py:82 msgid "Name" msgstr "Name" @@ -1076,7 +1076,7 @@ msgstr "You can't use old contact and create new at the same time" msgid "Please fill-out the email" msgstr "Please fill-out the e-mail" -#: publishers/models.py:31 publishers/views.py:43 templates/base.html:97 +#: publishers/models.py:31 publishers/views.py:45 templates/base.html:97 msgid "Publishers" msgstr "Publishers" @@ -1092,7 +1092,7 @@ msgstr "Phone" msgid "Address" msgstr "Address" -#: publishers/models.py:65 source/templates/source.html:80 +#: publishers/models.py:65 source/models.py:250 source/templates/source.html:80 msgid "Publisher contact" msgstr "Publisher contact" @@ -1104,20 +1104,29 @@ msgstr "Publisher contacts" msgid "Contacts:" msgstr "Contacts:" -#: publishers/templates/publisher.html:20 publishers/views.py:53 +#: publishers/templates/publisher.html:20 publishers/views.py:55 msgid "Edit contacts" msgstr "Edit contacts" -#: publishers/templates/publisher.html:24 source/models.py:308 +#: publishers/templates/publisher.html:24 source/models.py:309 #: source/views.py:254 templates/base.html:94 msgid "Sources" msgstr "Sources" -#: publishers/views.py:20 source/views.py:80 +#: publishers/views.py:22 source/views.py:80 msgid "Add publisher" msgstr "Add publisher" -#: qa/models.py:18 qa/templates/detail.html:13 source/models.py:307 +#: publishers/views.py:71 +#, python-format +msgid "" +"Contact person %(person)s is still set as contact on: %(sources)s, please " +"remove them there first." +msgstr "" +"Contact person %(person)s is still set as contact on: %(sources)s, please " +"remove them there first." + +#: qa/models.py:18 qa/templates/detail.html:13 source/models.py:308 msgid "Source" msgstr "Source" @@ -1305,83 +1314,83 @@ msgstr "" "Sources with status 'Archiving accepted' and 'Archiving without publisher " "consent' must have a selected Harvest Frequency" -#: source/models.py:259 source/templates/source.html:72 +#: source/models.py:260 source/templates/source.html:72 msgid "Suggested by" msgstr "Suggested by" -#: source/models.py:280 source/templates/source.html:102 +#: source/models.py:281 source/templates/source.html:102 msgid "Category" msgstr "Category" -#: source/models.py:285 source/templates/source.html:106 +#: source/models.py:286 source/templates/source.html:106 msgid "Sub category" msgstr "Sub category" -#: source/models.py:297 +#: source/models.py:298 msgid "Source is dead" msgstr "Source is dead" -#: source/models.py:298 source/templates/source.html:52 +#: source/models.py:299 source/templates/source.html:52 msgid "Priority source" msgstr "Priority source" -#: source/models.py:518 +#: source/models.py:519 msgid "default" msgstr "default" -#: source/models.py:519 +#: source/models.py:520 msgid "low" msgstr "low" -#: source/models.py:520 +#: source/models.py:521 msgid "very_low" msgstr "very_low" -#: source/models.py:531 +#: source/models.py:532 msgid "Main seed" msgstr "Main seed" -#: source/models.py:532 +#: source/models.py:533 msgid "Seed url" msgstr "Seed URL" -#: source/models.py:538 +#: source/models.py:539 msgid "From" msgstr "From" -#: source/models.py:539 +#: source/models.py:540 msgid "To" msgstr "To" -#: source/models.py:542 +#: source/models.py:543 msgid "Javascript" msgstr "Javascript" -#: source/models.py:543 +#: source/models.py:544 msgid "Global reject" msgstr "Global reject" -#: source/models.py:544 +#: source/models.py:545 msgid "Youtube" msgstr "YouTube" -#: source/models.py:545 +#: source/models.py:546 msgid "Calendars" msgstr "Calendars" -#: source/models.py:546 +#: source/models.py:547 msgid "Local traps" msgstr "Local traps" -#: source/models.py:547 +#: source/models.py:548 msgid "Redirect on seed" msgstr "Redirect on seed" -#: source/models.py:548 +#: source/models.py:549 msgid "Robots.txt active" msgstr "Robots.txt active" -#: source/models.py:565 +#: source/models.py:566 msgid "Seed" msgstr "Seed" diff --git a/Seeder/publishers/views.py b/Seeder/publishers/views.py index edde92d9..84e0f01e 100755 --- a/Seeder/publishers/views.py +++ b/Seeder/publishers/views.py @@ -1,6 +1,8 @@ from django.views.generic import DetailView, FormView +from django.utils.safestring import mark_safe from django.utils.translation import ugettext_lazy as _ from django.http.response import HttpResponseRedirect +from django.contrib import messages from dal import autocomplete @@ -63,7 +65,19 @@ def form_valid(self, form): contact.publisher = self.object contact.save() for obj in form.deleted_objects: - obj.delete() + if (isinstance(obj, models.ContactPerson) + and obj.source_set.exists()): + messages.add_message(self.request, messages.ERROR, mark_safe(_( + "Contact person %(person)s is still set as contact on: " + "%(sources)s, please remove them there first.") % { + "person": f"{obj.name} (#{obj.id})", + "sources": ", ".join([ + f"{s}" + for s in obj.source_set.all()]), + })) + else: + obj.delete() return HttpResponseRedirect(self.object.get_absolute_url()) diff --git a/Seeder/source/migrations/0009_auto_20241215_1640.py b/Seeder/source/migrations/0009_auto_20241215_1640.py new file mode 100644 index 00000000..1fa90de2 --- /dev/null +++ b/Seeder/source/migrations/0009_auto_20241215_1640.py @@ -0,0 +1,19 @@ +# Generated by Django 2.2.28 on 2024-12-15 16:40 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('source', '0008_source_priority_source'), + ] + + operations = [ + migrations.AlterField( + model_name='source', + name='publisher_contact', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='publishers.ContactPerson', verbose_name='Publisher contact'), + ), + ] diff --git a/Seeder/source/models.py b/Seeder/source/models.py index a9041246..52ba2b6e 100755 --- a/Seeder/source/models.py +++ b/Seeder/source/models.py @@ -247,7 +247,8 @@ class Source(SearchModel, SlugOrCreateModel, BaseModel): on_delete=models.DO_NOTHING) publisher_contact = models.ForeignKey( - ContactPerson, + verbose_name=_('Publisher contact'), + to=ContactPerson, null=True, blank=True, on_delete=models.DO_NOTHING)