2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-17 06:27:34 +00:00

add prior expo experience (readonly)

This commit is contained in:
2025-01-26 13:38:10 +00:00
parent 4f1d808720
commit 3ad75d4439
3 changed files with 16 additions and 7 deletions

View File

@@ -8,7 +8,8 @@ from django.conf import settings
from django.contrib.auth.models import User
from django.db import models
from troggle.core.models.troggle import DataIssue, Person
from troggle.core.models.troggle import DataIssue, Person, PersonExpedition
from troggle.core.utils import current_expo
"""This imports the registered troggle users, who are nearly-all, but not quite, Persons.
exceptions are "expo" and "expoadmin" which are created by the databaseReset.py import program.
@@ -19,12 +20,16 @@ Passwords are only ever stored as hashes using the standard Django functions.
"""
todo = """
- Make all this work with New people who have never been on expo before
- Not fully tested, needs experience
"""
USERS_FILE = "users.json"
ENCRYPTED_DIR = "encrypted"
def how_many_previous_expos(person):
return PersonExpedition.objects.filter(person=person).exclude(expedition__year=current_expo()).count()
def register_user(u, email, password=None, pwhash=None, fullname=""):
"""Create User and we may not have a Person to tie it to if it is a future caver.
Do not use the lastname field, put the whole free text identification into firstname