mirror of
https://github.com/ArchiveBox/ArchiveBox
synced 2024-11-21 19:53:06 +00:00
rename abid_utils to base_models
This commit is contained in:
parent
0db6437c4e
commit
569081a9eb
38 changed files with 80 additions and 90 deletions
|
@ -85,8 +85,8 @@ ARCHIVEBOX_BUILTIN_PLUGINS = {
|
||||||
'workers': PACKAGE_DIR / 'workers',
|
'workers': PACKAGE_DIR / 'workers',
|
||||||
'core': PACKAGE_DIR / 'core',
|
'core': PACKAGE_DIR / 'core',
|
||||||
'crawls': PACKAGE_DIR / 'crawls',
|
'crawls': PACKAGE_DIR / 'crawls',
|
||||||
|
# 'machine': PACKAGE_DIR / 'machine'
|
||||||
# 'search': PACKAGE_DIR / 'search',
|
# 'search': PACKAGE_DIR / 'search',
|
||||||
# 'core': PACKAGE_DIR / 'core',
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Load all user-defined ArchiveBox plugins
|
# Load all user-defined ArchiveBox plugins
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
__package__ = 'abid_utils'
|
|
|
@ -1,7 +0,0 @@
|
||||||
from django.apps import AppConfig
|
|
||||||
|
|
||||||
|
|
||||||
class AbidUtilsConfig(AppConfig):
|
|
||||||
default_auto_field = 'django.db.models.BigAutoField'
|
|
||||||
|
|
||||||
name = 'abid_utils'
|
|
|
@ -1,3 +0,0 @@
|
||||||
from django.test import TestCase
|
|
||||||
|
|
||||||
# Create your tests here.
|
|
|
@ -3,7 +3,7 @@ __package__ = 'archivebox.api'
|
||||||
from signal_webhooks.admin import WebhookAdmin
|
from signal_webhooks.admin import WebhookAdmin
|
||||||
from signal_webhooks.utils import get_webhook_model
|
from signal_webhooks.utils import get_webhook_model
|
||||||
|
|
||||||
from abid_utils.admin import ABIDModelAdmin
|
from archivebox.base_models.admin import ABIDModelAdmin
|
||||||
|
|
||||||
from api.models import APIToken
|
from api.models import APIToken
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
# Generated by Django 5.0.6 on 2024-06-03 01:52
|
# Generated by Django 5.0.6 on 2024-06-03 01:52
|
||||||
|
|
||||||
import abid_utils.models
|
|
||||||
import charidfield.fields
|
import charidfield.fields
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
import signal_webhooks.fields
|
import signal_webhooks.fields
|
||||||
|
@ -9,6 +8,8 @@ import uuid
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
import archivebox.base_models.models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
@ -63,7 +64,7 @@ class Migration(migrations.Migration):
|
||||||
('id', models.UUIDField(blank=True, null=True, unique=True)),
|
('id', models.UUIDField(blank=True, null=True, unique=True)),
|
||||||
('uuid', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
|
('uuid', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
|
||||||
('abid', charidfield.fields.CharIDField(blank=True, db_index=True, default=None, help_text='ABID-format identifier for this entity (e.g. snp_01BJQMF54D093DXEAWZ6JYRPAQ)', max_length=30, null=True, prefix='whk_', unique=True)),
|
('abid', charidfield.fields.CharIDField(blank=True, db_index=True, default=None, help_text='ABID-format identifier for this entity (e.g. snp_01BJQMF54D093DXEAWZ6JYRPAQ)', max_length=30, null=True, prefix='whk_', unique=True)),
|
||||||
('created_by', models.ForeignKey(default=abid_utils.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
('created_by', models.ForeignKey(default=archivebox.base_models.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'verbose_name': 'API Outbound Webhook',
|
'verbose_name': 'API Outbound Webhook',
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
# Generated by Django 5.1 on 2024-08-20 22:52
|
# Generated by Django 5.1 on 2024-08-20 22:52
|
||||||
|
|
||||||
import abid_utils.models
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
import archivebox.base_models.models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
@ -17,6 +18,6 @@ class Migration(migrations.Migration):
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='apitoken',
|
model_name='apitoken',
|
||||||
name='created_by',
|
name='created_by',
|
||||||
field=models.ForeignKey(default=abid_utils.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
|
field=models.ForeignKey(default=archivebox.base_models.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
# Generated by Django 5.1 on 2024-09-04 23:32
|
# Generated by Django 5.1 on 2024-09-04 23:32
|
||||||
|
|
||||||
import abid_utils.models
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
import archivebox.base_models.models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
@ -17,7 +18,7 @@ class Migration(migrations.Migration):
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='apitoken',
|
model_name='apitoken',
|
||||||
name='created',
|
name='created',
|
||||||
field=abid_utils.models.AutoDateTimeField(db_index=True, default=None),
|
field=archivebox.base_models.models.AutoDateTimeField(db_index=True, default=None),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='apitoken',
|
model_name='apitoken',
|
||||||
|
@ -32,7 +33,7 @@ class Migration(migrations.Migration):
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='outboundwebhook',
|
model_name='outboundwebhook',
|
||||||
name='created',
|
name='created',
|
||||||
field=abid_utils.models.AutoDateTimeField(db_index=True, default=None),
|
field=archivebox.base_models.models.AutoDateTimeField(db_index=True, default=None),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='outboundwebhook',
|
model_name='outboundwebhook',
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
# Generated by Django 5.1 on 2024-09-05 00:26
|
# Generated by Django 5.1 on 2024-09-05 00:26
|
||||||
|
|
||||||
import abid_utils.models
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
import archivebox.base_models.models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
@ -29,7 +30,7 @@ class Migration(migrations.Migration):
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='outboundwebhook',
|
model_name='outboundwebhook',
|
||||||
name='created_at',
|
name='created_at',
|
||||||
field=abid_utils.models.AutoDateTimeField(db_index=True, default=None),
|
field=archivebox.base_models.models.AutoDateTimeField(db_index=True, default=None),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='outboundwebhook',
|
model_name='outboundwebhook',
|
||||||
|
|
|
@ -11,7 +11,7 @@ from signal_webhooks.models import WebhookBase
|
||||||
|
|
||||||
from django_stubs_ext.db.models import TypedModelMeta
|
from django_stubs_ext.db.models import TypedModelMeta
|
||||||
|
|
||||||
from abid_utils.models import ABIDModel, ABIDField, AutoDateTimeField
|
from archivebox.base_models.models import ABIDModel, ABIDField, AutoDateTimeField
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
1
archivebox/base_models/__init__.py
Normal file
1
archivebox/base_models/__init__.py
Normal file
|
@ -0,0 +1 @@
|
||||||
|
__package__ = 'archivebox.base_models'
|
|
@ -1,4 +1,4 @@
|
||||||
__package__ = 'archivebox.abid_utils'
|
__package__ = 'archivebox.base_models'
|
||||||
|
|
||||||
from typing import NamedTuple, Any, Union, Dict
|
from typing import NamedTuple, Any, Union, Dict
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
__package__ = 'archivebox.abid_utils'
|
__package__ = 'archivebox.base_models'
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
7
archivebox/base_models/apps.py
Normal file
7
archivebox/base_models/apps.py
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
# class AbidUtilsConfig(AppConfig):
|
||||||
|
# default_auto_field = 'django.db.models.BigAutoField'
|
||||||
|
|
||||||
|
# name = 'base_models'
|
|
@ -53,7 +53,7 @@ def add(urls: str | list[str],
|
||||||
|
|
||||||
from crawls.models import Seed, Crawl
|
from crawls.models import Seed, Crawl
|
||||||
from workers.orchestrator import Orchestrator
|
from workers.orchestrator import Orchestrator
|
||||||
from abid_utils.models import get_or_create_system_user_pk
|
from archivebox.base_models.models import get_or_create_system_user_pk
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,8 @@ import abx
|
||||||
from archivebox.config import DATA_DIR
|
from archivebox.config import DATA_DIR
|
||||||
from archivebox.config.common import SERVER_CONFIG
|
from archivebox.config.common import SERVER_CONFIG
|
||||||
from archivebox.misc.paginators import AccelleratedPaginator
|
from archivebox.misc.paginators import AccelleratedPaginator
|
||||||
|
from archivebox.base_models.admin import ABIDModelAdmin
|
||||||
|
|
||||||
from abid_utils.admin import ABIDModelAdmin
|
|
||||||
|
|
||||||
from core.models import ArchiveResult, Snapshot
|
from core.models import ArchiveResult, Snapshot
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ from archivebox.index.html import snapshot_icons
|
||||||
from archivebox.extractors import archive_links
|
from archivebox.extractors import archive_links
|
||||||
from archivebox.main import remove
|
from archivebox.main import remove
|
||||||
|
|
||||||
from archivebox.abid_utils.admin import ABIDModelAdmin
|
from archivebox.base_models.admin import ABIDModelAdmin
|
||||||
from archivebox.workers.tasks import bg_archive_links, bg_add
|
from archivebox.workers.tasks import bg_archive_links, bg_add
|
||||||
|
|
||||||
from core.models import Tag
|
from core.models import Tag
|
||||||
|
|
|
@ -5,8 +5,8 @@ from django.utils.html import format_html, mark_safe
|
||||||
|
|
||||||
import abx
|
import abx
|
||||||
|
|
||||||
from abid_utils.admin import ABIDModelAdmin
|
|
||||||
from archivebox.misc.paginators import AccelleratedPaginator
|
from archivebox.misc.paginators import AccelleratedPaginator
|
||||||
|
from archivebox.base_models.admin import ABIDModelAdmin
|
||||||
|
|
||||||
from core.models import Tag
|
from core.models import Tag
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
|
|
||||||
from django.db import migrations
|
from django.db import migrations
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from abid_utils.abid import abid_from_values, DEFAULT_ABID_URI_SALT
|
|
||||||
|
from archivebox.base_models.abid import abid_from_values, DEFAULT_ABID_URI_SALT
|
||||||
|
|
||||||
|
|
||||||
def calculate_abid(self):
|
def calculate_abid(self):
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
# Generated by Django 5.0.6 on 2024-05-13 13:01
|
# Generated by Django 5.0.6 on 2024-05-13 13:01
|
||||||
|
|
||||||
import abid_utils.models
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
import django.utils.timezone
|
import django.utils.timezone
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
import archivebox.base_models.models
|
||||||
|
|
||||||
|
|
||||||
def updated_created_by_ids(apps, schema_editor):
|
def updated_created_by_ids(apps, schema_editor):
|
||||||
"""Get or create a system user with is_superuser=True to be the default owner for new DB rows"""
|
"""Get or create a system user with is_superuser=True to be the default owner for new DB rows"""
|
||||||
|
@ -45,7 +46,7 @@ class Migration(migrations.Migration):
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='archiveresult',
|
model_name='archiveresult',
|
||||||
name='created_by',
|
name='created_by',
|
||||||
field=models.ForeignKey(null=True, default=abid_utils.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
|
field=models.ForeignKey(null=True, default=archivebox.base_models.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='archiveresult',
|
model_name='archiveresult',
|
||||||
|
@ -61,7 +62,7 @@ class Migration(migrations.Migration):
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='snapshot',
|
model_name='snapshot',
|
||||||
name='created_by',
|
name='created_by',
|
||||||
field=models.ForeignKey(null=True, default=abid_utils.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
|
field=models.ForeignKey(null=True, default=archivebox.base_models.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='snapshot',
|
model_name='snapshot',
|
||||||
|
@ -77,7 +78,7 @@ class Migration(migrations.Migration):
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='tag',
|
model_name='tag',
|
||||||
name='created_by',
|
name='created_by',
|
||||||
field=models.ForeignKey(null=True, default=abid_utils.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
|
field=models.ForeignKey(null=True, default=archivebox.base_models.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='tag',
|
model_name='tag',
|
||||||
|
@ -101,16 +102,16 @@ class Migration(migrations.Migration):
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='snapshot',
|
model_name='snapshot',
|
||||||
name='created_by',
|
name='created_by',
|
||||||
field=models.ForeignKey(default=abid_utils.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
|
field=models.ForeignKey(default=archivebox.base_models.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='archiveresult',
|
model_name='archiveresult',
|
||||||
name='created_by',
|
name='created_by',
|
||||||
field=models.ForeignKey(default=abid_utils.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
|
field=models.ForeignKey(default=archivebox.base_models.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='tag',
|
model_name='tag',
|
||||||
name='created_by',
|
name='created_by',
|
||||||
field=models.ForeignKey(default=abid_utils.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
|
field=models.ForeignKey(default=archivebox.base_models.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
from django.db import migrations
|
from django.db import migrations
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from abid_utils.abid import ABID, abid_from_values, DEFAULT_ABID_URI_SALT
|
from archivebox.base_models.abid import ABID, abid_from_values, DEFAULT_ABID_URI_SALT
|
||||||
|
|
||||||
|
|
||||||
def calculate_abid(self):
|
def calculate_abid(self):
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
# Generated by Django 5.0.6 on 2024-08-18 05:37
|
# Generated by Django 5.0.6 on 2024-08-18 05:37
|
||||||
|
|
||||||
import core.models
|
|
||||||
import uuid
|
import uuid
|
||||||
import random
|
import random
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
from abid_utils.abid import ABID
|
from archivebox.base_models.abid import ABID
|
||||||
|
|
||||||
|
|
||||||
def rand_int_id():
|
def rand_int_id():
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
from abid_utils.abid import abid_from_values
|
from archivebox.base_models.abid import abid_from_values
|
||||||
from abid_utils.models import ABID
|
from archivebox.base_models.models import ABID
|
||||||
|
|
||||||
def calculate_abid(self):
|
def calculate_abid(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
# Generated by Django 5.1 on 2024-08-28 09:40
|
# Generated by Django 5.1 on 2024-08-28 09:40
|
||||||
|
|
||||||
import abid_utils.models
|
|
||||||
import django.utils.timezone
|
import django.utils.timezone
|
||||||
from django.db import migrations
|
from django.db import migrations
|
||||||
|
|
||||||
|
import archivebox.base_models.models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
@ -15,21 +16,21 @@ class Migration(migrations.Migration):
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='archiveresult',
|
model_name='archiveresult',
|
||||||
name='created',
|
name='created',
|
||||||
field=abid_utils.models.AutoDateTimeField(db_index=True, default=django.utils.timezone.now),
|
field=archivebox.base_models.models.AutoDateTimeField(db_index=True, default=django.utils.timezone.now),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='snapshot',
|
model_name='snapshot',
|
||||||
name='added',
|
name='added',
|
||||||
field=abid_utils.models.AutoDateTimeField(db_index=True, default=django.utils.timezone.now),
|
field=archivebox.base_models.models.AutoDateTimeField(db_index=True, default=django.utils.timezone.now),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='snapshot',
|
model_name='snapshot',
|
||||||
name='created',
|
name='created',
|
||||||
field=abid_utils.models.AutoDateTimeField(db_index=True, default=django.utils.timezone.now),
|
field=archivebox.base_models.models.AutoDateTimeField(db_index=True, default=django.utils.timezone.now),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='tag',
|
model_name='tag',
|
||||||
name='created',
|
name='created',
|
||||||
field=abid_utils.models.AutoDateTimeField(db_index=True, default=django.utils.timezone.now),
|
field=archivebox.base_models.models.AutoDateTimeField(db_index=True, default=django.utils.timezone.now),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
# Generated by Django 5.1 on 2024-09-04 09:00
|
# Generated by Django 5.1 on 2024-09-04 09:00
|
||||||
|
|
||||||
import abid_utils.models
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
import archivebox.base_models.models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
@ -17,22 +18,22 @@ class Migration(migrations.Migration):
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='archiveresult',
|
model_name='archiveresult',
|
||||||
name='created_by',
|
name='created_by',
|
||||||
field=models.ForeignKey(default=abid_utils.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, related_name='archiveresult_set', to=settings.AUTH_USER_MODEL),
|
field=models.ForeignKey(default=archivebox.base_models.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, related_name='archiveresult_set', to=settings.AUTH_USER_MODEL),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='snapshot',
|
model_name='snapshot',
|
||||||
name='added',
|
name='added',
|
||||||
field=abid_utils.models.AutoDateTimeField(db_index=True, default=None),
|
field=archivebox.base_models.models.AutoDateTimeField(db_index=True, default=None),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='snapshot',
|
model_name='snapshot',
|
||||||
name='created',
|
name='created',
|
||||||
field=abid_utils.models.AutoDateTimeField(db_index=True, default=None),
|
field=archivebox.base_models.models.AutoDateTimeField(db_index=True, default=None),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='snapshot',
|
model_name='snapshot',
|
||||||
name='created_by',
|
name='created_by',
|
||||||
field=models.ForeignKey(default=abid_utils.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, related_name='snapshot_set', to=settings.AUTH_USER_MODEL),
|
field=models.ForeignKey(default=archivebox.base_models.models.get_or_create_system_user_pk, on_delete=django.db.models.deletion.CASCADE, related_name='snapshot_set', to=settings.AUTH_USER_MODEL),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='snapshot',
|
model_name='snapshot',
|
||||||
|
@ -47,6 +48,6 @@ class Migration(migrations.Migration):
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='tag',
|
model_name='tag',
|
||||||
name='created',
|
name='created',
|
||||||
field=abid_utils.models.AutoDateTimeField(db_index=True, default=None),
|
field=archivebox.base_models.models.AutoDateTimeField(db_index=True, default=None),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
# Generated by Django 5.1 on 2024-09-04 23:23
|
# Generated by Django 5.1 on 2024-09-04 23:23
|
||||||
|
|
||||||
import abid_utils.models
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
import archivebox.base_models.models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
@ -30,7 +31,7 @@ class Migration(migrations.Migration):
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='archiveresult',
|
model_name='archiveresult',
|
||||||
name='created',
|
name='created',
|
||||||
field=abid_utils.models.AutoDateTimeField(db_index=True, default=None),
|
field=archivebox.base_models.models.AutoDateTimeField(db_index=True, default=None),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='archiveresult',
|
model_name='archiveresult',
|
||||||
|
|
|
@ -24,31 +24,17 @@ from django.conf import settings
|
||||||
import abx
|
import abx
|
||||||
|
|
||||||
from archivebox.config import CONSTANTS
|
from archivebox.config import CONSTANTS
|
||||||
|
|
||||||
from abid_utils.models import ABIDModel, ABIDField, AutoDateTimeField, ModelWithOutputDir
|
|
||||||
from workers.models import ModelWithStateMachine
|
|
||||||
from workers.tasks import bg_archive_snapshot
|
|
||||||
from crawls.models import Crawl
|
|
||||||
# from machine.models import Machine, NetworkInterface
|
|
||||||
|
|
||||||
from archivebox.misc.system import get_dir_size
|
from archivebox.misc.system import get_dir_size
|
||||||
from archivebox.misc.util import parse_date, base_url
|
from archivebox.misc.util import parse_date, base_url
|
||||||
from archivebox.index.schema import Link
|
from archivebox.index.schema import Link
|
||||||
from archivebox.index.html import snapshot_icons
|
from archivebox.index.html import snapshot_icons
|
||||||
from archivebox.extractors import ARCHIVE_METHODS_INDEXING_PRECEDENCE
|
from archivebox.extractors import ARCHIVE_METHODS_INDEXING_PRECEDENCE
|
||||||
|
from archivebox.base_models.models import ABIDModel, ABIDField, AutoDateTimeField, ModelWithOutputDir
|
||||||
|
|
||||||
|
from workers.models import ModelWithStateMachine
|
||||||
# class BaseModel(models.Model):
|
from workers.tasks import bg_archive_snapshot
|
||||||
# # TODO: migrate all models to a shared base class with all our standard fields and helpers:
|
from crawls.models import Crawl
|
||||||
# # ulid/created_at/modified_at/created_by/is_deleted/as_json/from_json/etc.
|
# from machine.models import Machine, NetworkInterface
|
||||||
# #
|
|
||||||
# # id = models.AutoField(primary_key=True, serialize=False, verbose_name='ID')
|
|
||||||
# # ulid = models.CharField(max_length=26, null=True, blank=True, db_index=True, unique=True)
|
|
||||||
|
|
||||||
# class Meta(TypedModelMeta):
|
|
||||||
# abstract = True
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,6 @@ INSTALLED_APPS = [
|
||||||
'django_object_actions', # provides easy Django Admin action buttons on change views https://github.com/crccheck/django-object-actions
|
'django_object_actions', # provides easy Django Admin action buttons on change views https://github.com/crccheck/django-object-actions
|
||||||
|
|
||||||
# Our ArchiveBox-provided apps
|
# Our ArchiveBox-provided apps
|
||||||
# 'abid_utils', # handles ABID ID creation, handling, and models
|
|
||||||
'config', # ArchiveBox config settings (loaded as a plugin, don't need to add it here)
|
'config', # ArchiveBox config settings (loaded as a plugin, don't need to add it here)
|
||||||
'machine', # handles collecting and storing information about the host machine, network interfaces, installed binaries, etc.
|
'machine', # handles collecting and storing information about the host machine, network interfaces, installed binaries, etc.
|
||||||
'workers', # handles starting and managing background workers and processes (orchestrators and actors)
|
'workers', # handles starting and managing background workers and processes (orchestrators and actors)
|
||||||
|
|
|
@ -5,7 +5,7 @@ from django.contrib import admin
|
||||||
|
|
||||||
from archivebox import DATA_DIR
|
from archivebox import DATA_DIR
|
||||||
|
|
||||||
from abid_utils.admin import ABIDModelAdmin
|
from archivebox.base_models.admin import ABIDModelAdmin
|
||||||
|
|
||||||
from core.models import Snapshot
|
from core.models import Snapshot
|
||||||
from crawls.models import Seed, Crawl, CrawlSchedule
|
from crawls.models import Seed, Crawl, CrawlSchedule
|
||||||
|
|
|
@ -11,10 +11,10 @@ from django.conf import settings
|
||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
from workers.models import ModelWithStateMachine
|
|
||||||
|
|
||||||
from archivebox.config import CONSTANTS
|
from archivebox.config import CONSTANTS
|
||||||
from abid_utils.models import ABIDModel, ABIDField, AutoDateTimeField, ModelWithHealthStats, get_or_create_system_user_pk
|
from archivebox.base_models.models import ABIDModel, ABIDField, AutoDateTimeField, ModelWithHealthStats, get_or_create_system_user_pk
|
||||||
|
|
||||||
|
from workers.models import ModelWithStateMachine
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from core.models import Snapshot, ArchiveResult
|
from core.models import Snapshot, ArchiveResult
|
||||||
|
|
|
@ -35,7 +35,7 @@ def remove_from_sql_main_index(snapshots: QuerySet, atomic: bool=False, out_dir:
|
||||||
@enforce_types
|
@enforce_types
|
||||||
def write_link_to_sql_index(link: Link, created_by_id: int | None=None):
|
def write_link_to_sql_index(link: Link, created_by_id: int | None=None):
|
||||||
from core.models import Snapshot, ArchiveResult
|
from core.models import Snapshot, ArchiveResult
|
||||||
from abid_utils.models import get_or_create_system_user_pk
|
from archivebox.base_models.models import get_or_create_system_user_pk
|
||||||
|
|
||||||
info = {k: v for k, v in link._asdict().items() if k in Snapshot.keys}
|
info = {k: v for k, v in link._asdict().items() if k in Snapshot.keys}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import abx
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.utils.html import format_html
|
from django.utils.html import format_html
|
||||||
|
|
||||||
from abid_utils.admin import ABIDModelAdmin
|
from archivebox.base_models.admin import ABIDModelAdmin
|
||||||
|
|
||||||
from machine.models import Machine, NetworkInterface, InstalledBinary
|
from machine.models import Machine, NetworkInterface, InstalledBinary
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Generated by Django 5.1.1 on 2024-10-02 04:34
|
# Generated by Django 5.1.1 on 2024-10-02 04:34
|
||||||
|
|
||||||
import archivebox.abid_utils.models
|
import archivebox.base_models.models
|
||||||
import charidfield.fields
|
import charidfield.fields
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
@ -42,7 +42,7 @@ class Migration(migrations.Migration):
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"created_at",
|
"created_at",
|
||||||
archivebox.abid_utils.models.AutoDateTimeField(
|
archivebox.base_models.models.AutoDateTimeField(
|
||||||
db_index=True, default=None
|
db_index=True, default=None
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -99,7 +99,7 @@ class Migration(migrations.Migration):
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"created_at",
|
"created_at",
|
||||||
archivebox.abid_utils.models.AutoDateTimeField(
|
archivebox.base_models.models.AutoDateTimeField(
|
||||||
db_index=True, default=None
|
db_index=True, default=None
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Generated by Django 5.1.1 on 2024-10-03 07:25
|
# Generated by Django 5.1.1 on 2024-10-03 07:25
|
||||||
|
|
||||||
import archivebox.abid_utils.models
|
import archivebox.base_models.models
|
||||||
import charidfield.fields
|
import charidfield.fields
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
@ -47,7 +47,7 @@ class Migration(migrations.Migration):
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"created_at",
|
"created_at",
|
||||||
archivebox.abid_utils.models.AutoDateTimeField(
|
archivebox.base_models.models.AutoDateTimeField(
|
||||||
db_index=True, default=None
|
db_index=True, default=None
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -12,7 +12,7 @@ import abx
|
||||||
import archivebox
|
import archivebox
|
||||||
|
|
||||||
from abx_pkg import Binary, BinProvider
|
from abx_pkg import Binary, BinProvider
|
||||||
from archivebox.abid_utils.models import ABIDModel, ABIDField, AutoDateTimeField, ModelWithHealthStats
|
from archivebox.base_models.models import ABIDModel, ABIDField, AutoDateTimeField, ModelWithHealthStats
|
||||||
|
|
||||||
from .detect import get_host_guid, get_os_info, get_vm_info, get_host_network, get_host_stats
|
from .detect import get_host_guid, get_os_info, get_vm_info, get_host_network, get_host_stats
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
from django.db import models
|
# from django.db import models
|
||||||
|
|
||||||
from abid_utils.models import ABIDModel, ABIDField, AutoDateTimeField, ModelWithHealthStats
|
# from archivebox.base_models.models import ABIDModel, ABIDField, AutoDateTimeField, ModelWithHealthStats
|
||||||
|
|
||||||
from django.conf import settings
|
# from django.conf import settings
|
||||||
|
|
||||||
|
|
||||||
# class Persona(ABIDModel, ModelWithHealthStats):
|
# class Persona(ABIDModel, ModelWithHealthStats):
|
||||||
|
|
Loading…
Reference in a new issue