move everything out of legacy folder

This commit is contained in:
Nick Sweeting 2019-04-27 17:26:24 -04:00
parent 553f312125
commit 1b8abc0961
74 changed files with 3162 additions and 2629 deletions

View file

@ -1,9 +1,7 @@
from datetime import datetime
from django.contrib import admin
from .models import Page
from core.models import Page
class PageAdmin(admin.ModelAdmin):
list_display = ('timestamp', 'short_url', 'title', 'is_archived', 'num_outputs', 'added', 'updated', 'url_hash')

View file

@ -4,8 +4,8 @@ import uuid
from django.db import models
from legacy.schema import Link
from legacy.util import parse_date
from ..util import parse_date
from ..index.schema import Link
class Page(models.Model):

View file

@ -2,8 +2,8 @@ from django.shortcuts import render
from django.views import View
from legacy.config import OUTPUT_DIR
from legacy.index import load_main_index, load_main_index_meta
from .index import load_main_index, load_main_index_meta
from .config import OUTPUT_DIR
class MainIndex(View):
@ -34,7 +34,7 @@ class AddLinks(View):
def post(self, request):
import_path = request.POST['url']
# TODO: add the links to the index here using archivebox.legacy.main.update_archive_data
# TODO: add the links to the index here using archivebox.main.add
print(f'Adding URL: {import_path}')
return render(template_name=self.template, request=request, context={})

View file

@ -1,4 +1,17 @@
print()
print('[i] Welcome to the ArchiveBox Shell! Example usage:')
print(' Page.objects.all()')
print(' User.objects.all()')
from cli import list_subcommands
from .config import ANSI
if __name__ == '__main__':
print('{green}# ArchiveBox Imports{reset}'.format(**ANSI))
# print('from archivebox.core.models import Page, User')
print('{green}from archivebox.cli import\narchivebox_{}{reset}'.format("\narchivebox_".join(list_subcommands().keys()), **ANSI))
print()
print('[i] Welcome to the ArchiveBox Shell! Example use:')
print(' print(Page.objects.filter(is_archived=True).count())')
print(' Page.objects.get(url="https://example.com").as_json()')
print(' Page.objects.get(url="https://example.com").as_json()')
print(' from archivebox.main import get_invalid_folders')