• Re: FreeBSD Port: py311-dj51-django-auditlog-3.0.0

    From Michael Gmelin@grembo@freebsd.org to muc.lists.freebsd.ports on Mon Sep 29 15:00:56 2025
    From Newsgroup: muc.lists.freebsd.ports


    On Sat, 27 Sep 2025 21:53:51 +0200
    Gerald Wilhelm <gerald.wilhelm@me.com> wrote:
    Hi Michael

    My name is Gerald and I'm a paperless user since many years.
    Currently my instance runs with docker on an old Qnap-NAS, but I want
    to move it to my new FreeBSD based home server in a jail. So thank
    you for making paperless-ngx available for FreeBSD. The installation
    with pkg wasn't a problem, I could upload some pdfs into the new
    paperless and work with them and export them normally. To transfer my documents I used document_exporter on the old instance 2.16.3 and
    tried to import them with document_importer on the new instance,
    where I ran into this error:

    root@paperless:~ # su -l paperless
    $ paperless document_importer /tmp/paperless_216_20250920
    Checking the manifest
    Database import failed
    No version information present
    Traceback (most recent call last):
    File
    "/usr/local/lib/python3.11/site-packages/django/db/models/options.py",
    line 676, in get_field return self.fields_map[field_name] ~~~~~~~~~~~~~~~^^^^^^^^^^^^ KeyError: 'remote_port'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "/usr/local/lib/python3.11/site-packages/django/core/serializers/json.py", line 70, in Deserializer yield from PythonDeserializer(objects,
    **options) File "/usr/local/lib/python3.11/site-packages/django/core/serializers/python.py", line 141, in Deserializer field = Model._meta.get_field(field_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/django/db/models/options.py",
    line 678, in get_field raise FieldDoesNotExist( django.core.exceptions.FieldDoesNotExist: LogEntry has no field named 'remote_port'

    The above exception was the direct cause of the following exception:

    Traceback (most recent call last):
    File "/usr/local/lib/python3.11/site-packages/paperless/manage.py",
    line 10, in <module> execute_from_command_line(sys.argv)
    File "/usr/local/lib/python3.11/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line utility.execute() File "/usr/local/lib/python3.11/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python3.11/site-packages/django/core/management/base.py", line 413, in run_from_argv self.execute(*args, **cmd_options) File "/usr/local/lib/python3.11/site-packages/django/core/management/base.py", line 459, in execute output = self.handle(*args, **options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/paperless/documents/management/commands/document_importer.py",
    line 280, in handle self.load_data_to_database() File "/usr/local/lib/python3.11/site-packages/paperless/documents/management/commands/document_importer.py",
    line 223, in load_data_to_database raise e File "/usr/local/lib/python3.11/site-packages/paperless/documents/management/commands/document_importer.py",
    line 204, in load_data_to_database call_command("loaddata",
    manifest_path) File "/usr/local/lib/python3.11/site-packages/django/core/management/__init__.py", line 194, in call_command return command.execute(*args, **defaults) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/django/core/management/base.py", line 459, in execute output = self.handle(*args, **options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/django/core/management/commands/loaddata.py",
    line 103, in handle self.loaddata(fixture_labels) File "/usr/local/lib/python3.11/site-packages/django/core/management/commands/loaddata.py",
    line 164, in loaddata self.load_label(fixture_label) File "/usr/local/lib/python3.11/site-packages/django/core/management/commands/loaddata.py",
    line 252, in load_label for obj in objects: File "/usr/local/lib/python3.11/site-packages/django/core/serializers/json.py", line 74, in Deserializer raise DeserializationError() from exc django.core.serializers.base.DeserializationError: Problem installing
    fixture '/tmp/paperless_216_20250920/manifest.jsonrCy:




    After some investigation I found out, that in the db of the FreeBSD
    variant of paperless the field remote_port is missing in the table
    logentry. Which lead me to the command 'paperless showmigrations', so
    that I could compare the migrations of my two instances. The only
    difference I found were this two migrations:

    auditlog
    ...
    [X] 0016_logentry_remote_port
    [X] 0017_add_actor_email

    Looking
    into https://github.com/jazzband/django-auditlog/tree/v3.1.0/auditlog/migrations shows, that this two migrations were introduced with version 3.1.0 of django-auditlog, but the port of paperless 2.16 is using version 3.0.0 of it.

    A first very, very naive try to solve this, was to install pip via
    pkg, removing py311-dj51-django-auditlog via pkg and installing django-auditlog via pip. Result: import works, paperless itself
    works, but export crashes, which I use to backup the documents.

    My second attempt was to use the port collection. Here what I tried:
    - installed ports collection into jail
    - adapted Makefile and distinfo in
    /usr/ports/www/py-dj51-django-auditlog with some help from claude
    code (sorry, never touched a port before)
    - pkg remove -f py311-dj51-django-auditlog
    - make install
    - pkg check -d -> Checking all packages: 100%
    - restart paperless jail
    - import of documents works
    - paperless itself works, so far I could test it
    - export of documents works

    Could you please have a look into the problem?
    Please find the diff file for the port attached to this email.

    Hi Gerald,
    Thanks for reaching out. I never hit this problem myself (probably due
    to not importing documents recently, but only adding scanned documents
    over scanner/consumer).
    As it turns out, django-auditlog changed the spelling of their release artifacts on pypi from django-auditlog to django_auditlog, therefore
    portscout didn't pick up the new version.
    I'll address the issue soon.
    Cheers
    Michael
    --
    Michael Gmelin
    --
    Posted automagically by a mail2news gateway at muc.de e.V.
    Please direct questions, flames, donations, etc. to news-admin@muc.de
    --- Synchronet 3.21a-Linux NewsLink 1.2