Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More gazette improvements #1748

Merged
merged 2 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion peachjam/adapters/indigo.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,13 @@ def get_doc_list(self):
logger.info(f"Getting document list for {place_code}")
url = f"{self.api_url}/akn/{place_code}/.json"
while url:
res = self.client_get(url).json()
try:
res = self.client_get(url).json()
except requests.exceptions.HTTPError as e:
if e.response.status_code == 404:
logger.warning(f"Ignoring 404 for {url}")
continue
raise e

# ignore bills
# TODO: later, make this configurable
Expand Down
15 changes: 13 additions & 2 deletions peachjam/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
citations_processor,
pj_settings,
)
from peachjam.plugins import plugins
from peachjam.resources import (
ArticleResource,
AttorneyResource,
Expand Down Expand Up @@ -821,12 +822,22 @@ class IngestorSettingInline(admin.TabularInline):
extra = 3


class IngestorForm(forms.ModelForm):
adapter = forms.ChoiceField(
choices=lambda: [(y, y) for y in plugins.registry["ingestor-adapter"].keys()]
)

class Meta:
model = Ingestor
fields = ("adapter", "name", "last_refreshed_at", "enabled")


@admin.register(Ingestor)
class IngestorAdmin(admin.ModelAdmin):
inlines = [IngestorSettingInline]
actions = ["refresh_all_content"]
fields = ("adapter", "name", "last_refreshed_at", "enabled")
list_display = ("name", "last_refreshed_at", "enabled")
list_display = ("name", "adapter", "last_refreshed_at", "enabled")
form = IngestorForm

def refresh_all_content(self, request, queryset):
from peachjam.tasks import run_ingestor
Expand Down
20 changes: 20 additions & 0 deletions peachjam/migrations/0121_alter_ingestorsetting_value.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 3.2.20 on 2024-03-01 08:43

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("peachjam", "0120_gazette_details"),
]

operations = [
migrations.AlterField(
model_name="ingestorsetting",
name="value",
field=models.CharField(
blank=True, default="", max_length=2048, verbose_name="value"
),
),
]
Loading