Skip to content

Commit

Permalink
#702: add Source.priority_source similar to dead_source, update trans…
Browse files Browse the repository at this point in the history
…lations and filters
  • Loading branch information
Fasand committed Dec 15, 2024
1 parent 1e96528 commit 2c02173
Show file tree
Hide file tree
Showing 8 changed files with 210 additions and 176 deletions.
176 changes: 90 additions & 86 deletions Seeder/locale/cs/LC_MESSAGES/django.po

Large diffs are not rendered by default.

176 changes: 90 additions & 86 deletions Seeder/locale/en_US/LC_MESSAGES/django.po

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Seeder/source/field_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',),
Expand Down
3 changes: 2 additions & 1 deletion Seeder/source/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
18 changes: 18 additions & 0 deletions Seeder/source/migrations/0008_source_priority_source.py
Original file line number Diff line number Diff line change
@@ -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'),
),
]
4 changes: 3 additions & 1 deletion Seeder/source/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Seeder/source/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
Expand Down
4 changes: 4 additions & 0 deletions Seeder/source/templates/source.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ <h4>{% trans 'Info' %}</h4>
<td>{% trans 'Dead' %}</td>
<td>{{ source.dead_source|fa_boolean }}</td>
</tr>
<tr>
<td>{% trans 'Priority source' %}</td>
<td>{{ source.priority_source|fa_boolean }}</td>
</tr>
<tr>
<td>{% trans 'Owner' %}</td>
<td>{{ source.owner.get_full_name }}</td>
Expand Down

0 comments on commit 2c02173

Please sign in to comment.