Open Keridos opened 1 month ago
Will look into that. Please use the "evap" user as described in step 3 of the installation section in the readme for now: https://github.com/e-valuation/EvaP?tab=readme-ov-file#installation-for-development
I also noticed the problem after loading custom data which did not have a superuser.
@richardebeling pointed out that REQUIRED_FIELDS should fix it :+1:
@Keridos do you want to open a pull request that adds the first_name
and last_name
fields to the REQUIRED_FIELDS
class attribute? I would appreciate it! :)
The relevant lines should be https://github.com/e-valuation/EvaP/blob/a1af82ac3886999e4cecbf4fb88266373270eea8/evap/evaluation/models.py#L1657 and https://github.com/e-valuation/EvaP/blob/a1af82ac3886999e4cecbf4fb88266373270eea8/evap/evaluation/models.py#L1735
As I got no experience with django projects I have a question there: I can add the fields first_name_given
and last_name
to the required fields. But does django know that when calling create_superuser that first_name
is actually passed from first_name_given
?. The variable names in there are a bit confusing.
Ah, good point, I think we didn't handle that the way django intends in #1903 (see the change here).
My understanding of the django docs on custom user profile managers is that the argument for create_user
and create_superuser
probably should also be renamed from first_name
to first_name_given
. Then, I'd expect that having first_name_given
in the REQUIRED_FIELDS
works.
(background information regarding the variable naming: Since #1903, we distinguish between first_name_given
, the first name that the person legally has and may not have control over, and first_name_chosen
, the preferred first name that the person would like to be addressed by)
Using docker provider. Start up a fresh docker instance via Vagrant. Try the create superuser command. It asks for login email and password. Enter credentials. It then crashes due to the postgresql having a constraint that first name of a user must not be null.