Re: pglister: bug: Can't add moderators (and create lists)

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Célestin Matte <celestin(dot)matte(at)cmatte(dot)me>
Cc: PostgreSQL WWW <pgsql-www(at)lists(dot)postgresql(dot)org>
Subject: Re: pglister: bug: Can't add moderators (and create lists)
Date: 2021-09-21 07:02:03
Message-ID: CABUevEypG4KjnY_2Ps6Lj1qdKqw8De=CMUO8notFoaNWsf14Lw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-www

On Mon, Sep 20, 2021 at 6:15 PM Célestin Matte <celestin(dot)matte(at)cmatte(dot)me> wrote:
>
> Hello,
>
> >> In the interface (in /admin/lists/list/1/change/), I cannot create a list because the "Moderators" field is always empty, and django won't let me create a list without moderators.
> >
> > The reason the moderators field is mandatory, is that it's what's used
> > to populate the list ownership alias. I think there may have been
> > other reasons as well, see the commit message in 78dc0eea, but I don't
> > recall exactly what they are. But that is definitely one reason for it
> > being there now, so we can't remove that.
> >
> > You should be able to add any Subscriber as a moderator, they don't
> > have to be a member of the particular list. The Subscriber entry is
> > created the first time the user logged in, see
> > web/pglister/lists/migration.py. Did you somehow manage to log in
> > without this happening?
>
> It turns out the issue was not in Django, but client-side: JS files for admin were missing, so the moderator field was not filled.

Oh. Oops :)

> I already noticed that CSS files were missing from /admin/, and made a PR back then: https://gitlab.com/pglister/pglister/-/merge_requests/24 (Should I rather make PRs on gitlab or send patches on this list?)

MR/PR on gitlab is perfectly fine -- I had just missed it this time.

That said, the MR is incorrect and we should not be importing a select
part of django into our repository -- we should only have our own CSS
there -- just like we don't import the python code. We link to it in
wherever it is installed.

For example, for my local pglister installation I have a mapping for
static files of:
/media/admin ->
/home/mha/django/django22-py3/lib/python3.7/site-packages/django/contrib/admin/static/admin

(this being in my virtualenv that holds the django installation)

> Are CSS, JS and font files supposed to be somehow generated, or should I make a patch adding them all manually?

*Our* CSS and JS files are all in the repo and should just be served
up under /media. The django ones should be served up from django.
There are no CSS or JS files being generated at this time.

> Unrelated issue I encountered when debugging: when activating logging in django, the log file get spammed with exceptions every time django is hitting a {%if somevariable %} syntax, even though that's the correct django way to test variable existence [1]. Any idea what could be causing that?
> [1] https://docs.djangoproject.com/en/2.2/ref/templates/builtins/#if

That's strange. I don't see any of that. Exactly what does the
exception look like?

--
Magnus Hagander
Me: https://www.hagander.net/
Work: https://www.redpill-linpro.com/

In response to

Responses

Browse pgsql-www by date

  From Date Subject
Next Message Magnus Hagander 2021-09-21 07:52:44 Re: Add team 'Aiven' to planet blog
Previous Message Célestin Matte 2021-09-20 16:15:45 Re: pglister: bug: Can't add moderators (and create lists)