New WaitingListEntry (#33)

Sorted the pre-commit things... some were because of `src/static` being included, and some have been fixed in another PR 🎉

Reviewed-on: data.coop/membersystem#33
Reviewed-by: valberg <valberg@orn.li>
Co-authored-by: Benjamin Bach <benjamin@overtag.dk>
Co-committed-by: Benjamin Bach <benjamin@overtag.dk>
This commit is contained in:
Benjamin Bach 2024-07-31 22:49:46 +00:00 committed by valberg
parent 0cf579c5f6
commit 865bc6c7bd
7 changed files with 93 additions and 27 deletions

4
.gitignore vendored
View file

@ -8,3 +8,7 @@ db.sqlite3
.env .env
venv/ venv/
.venv/ .venv/
# collectstatic
src/static/

View file

@ -1,6 +1,5 @@
DOCKER_COMPOSE = COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker compose DOCKER_COMPOSE = COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker compose
DOCKER_RUN = ${DOCKER_COMPOSE} run -u `id -u` DOCKER_RUN = ${DOCKER_COMPOSE} run -u `id -u`
DOCKER_BUILD = DOCKER_BUILDKIT=1 docker build
MANAGE_EXEC = python /app/src/manage.py MANAGE_EXEC = python /app/src/manage.py
MANAGE_COMMAND = ${DOCKER_RUN} app ${MANAGE_EXEC} MANAGE_COMMAND = ${DOCKER_RUN} app ${MANAGE_EXEC}
@ -21,3 +20,6 @@ shell:
manage_command: manage_command:
${MANAGE_COMMAND} ${ARGS} ${MANAGE_COMMAND} ${ARGS}
build:
${DOCKER_COMPOSE} build

View file

@ -7,7 +7,6 @@ There are two ways to setup the development environment.
- Using the Docker Compose setup provided in this repository. - Using the Docker Compose setup provided in this repository.
- Using [hatch](https://hatch.pypa.io/) in your host OS. - Using [hatch](https://hatch.pypa.io/) in your host OS.
### Using Docker Compose ### Using Docker Compose
Working with the Docker Compose setup is made easy with the `Makefile` provided in the repository. Working with the Docker Compose setup is made easy with the `Makefile` provided in the repository.
@ -41,6 +40,19 @@ make migrate
make run make run
``` ```
#### Building and running other things
```bash
# Build the containers
make build
# Create a superuser
make createsuperuser
# Create Django migrations (after this, maybe you need to change file permissions in volume)
make makemigrations
```
### Using hatch ### Using hatch
#### Requirements #### Requirements

View file

@ -5,6 +5,7 @@ from django.contrib import admin
from .models import Membership from .models import Membership
from .models import MembershipType from .models import MembershipType
from .models import SubscriptionPeriod from .models import SubscriptionPeriod
from .models import WaitingListEntry
@admin.register(Membership) @admin.register(Membership)
@ -20,3 +21,8 @@ class MembershipTypeAdmin(admin.ModelAdmin):
@admin.register(SubscriptionPeriod) @admin.register(SubscriptionPeriod)
class SubscriptionPeriodAdmin(admin.ModelAdmin): class SubscriptionPeriodAdmin(admin.ModelAdmin):
"""Admin for SubscriptionPeriod model.""" """Admin for SubscriptionPeriod model."""
@admin.register(WaitingListEntry)
class WaitingListEntryAdmin(admin.ModelAdmin):
"""Admin for WaitingList model."""

View file

@ -0,0 +1,32 @@
# Generated by Django 5.0.7 on 2024-07-20 20:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('membership', '0005_member'),
]
operations = [
migrations.CreateModel(
name='WaitingListEntry',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('modified', models.DateTimeField(auto_now=True, verbose_name='modified')),
('created', models.DateTimeField(auto_now_add=True, verbose_name='created')),
('email', models.EmailField(max_length=254)),
('geography', models.CharField(blank=True, default='', verbose_name='geography')),
('comment', models.TextField(blank=True)),
],
options={
'verbose_name': 'waiting list entry',
'verbose_name_plural': 'waiting list entries',
},
),
migrations.AlterModelOptions(
name='membership',
options={'verbose_name': 'medlemskab', 'verbose_name_plural': 'medlemskaber'},
),
]

View file

@ -139,3 +139,18 @@ class MembershipType(CreatedModifiedAbstract):
def __str__(self) -> str: def __str__(self) -> str:
return self.name return self.name
class WaitingListEntry(CreatedModifiedAbstract):
"""People who for some reason could want to be added to a waiting list and invited to join later."""
email = models.EmailField()
geography = models.CharField(verbose_name=_("geography"), blank=True, default="")
comment = models.TextField(blank=True)
def __str__(self) -> str:
return self.email
class Meta:
verbose_name = _("waiting list entry")
verbose_name_plural = _("waiting list entries")

View file

@ -1,5 +0,0 @@
[pytest]
testpaths = .
python_files = tests.py test_*.py *_tests.py
DJANGO_SETTINGS_MODULE = project.settings
#norecursedirs = dist tmp* .svn .*