New app: clubs

- Clubs will be used both by the cof and the bds app.
- For now, they are only visible in development.
This commit is contained in:
Martin Pépin 2019-10-06 19:59:07 +02:00
parent 8ccaf8beaf
commit 380e38519b
No known key found for this signature in database
GPG key ID: E7520278B1774448
11 changed files with 78 additions and 5 deletions

View file

@ -52,9 +52,9 @@ linters:
- pip install --upgrade black isort flake8
script:
- black --check .
- isort --recursive --check-only --diff bda bds cof events gestioncof kfet petitscours provisioning shared utils
- isort --recursive --check-only --diff bda bds clubs cof events gestioncof kfet petitscours provisioning shared utils
# Print errors only
- flake8 --exit-zero bda bds cof events gestioncof kfet petitscours provisioning shared utils
- flake8 --exit-zero bda bds clubs cof events gestioncof kfet petitscours provisioning shared utils
cache:
key: linters
paths:

0
clubs/__init__.py Normal file
View file

5
clubs/admin.py Normal file
View file

@ -0,0 +1,5 @@
from django.contrib import admin
from clubs.models import Club
admin.site.register(Club)

5
clubs/apps.py Normal file
View file

@ -0,0 +1,5 @@
from django.apps import AppConfig
class ClubsConfig(AppConfig):
name = "clubs"

View file

@ -0,0 +1,46 @@
# Generated by Django 2.2.6 on 2019-10-06 17:57
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [migrations.swappable_dependency(settings.AUTH_USER_MODEL)]
operations = [
migrations.CreateModel(
name="Club",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"name",
models.CharField(
max_length=1000, unique=True, verbose_name="nom du club"
),
),
(
"description",
models.TextField(blank=True, verbose_name="description"),
),
(
"respos",
models.ManyToManyField(
blank=True,
to=settings.AUTH_USER_MODEL,
verbose_name="responsables du club",
),
),
],
)
]

View file

16
clubs/models.py Normal file
View file

@ -0,0 +1,16 @@
from django.contrib.auth import get_user_model
from django.db import models
from django.utils.translation import gettext_lazy as _
User = get_user_model()
class Club(models.Model):
name = models.CharField(_("nom du club"), max_length=1000, unique=True)
description = models.TextField(_("description"), blank=True)
respos = models.ManyToManyField(
User, verbose_name=_("responsables du club"), blank=True
)
def __str__(self):
return self.name

0
clubs/views.py Normal file
View file

View file

@ -17,7 +17,7 @@ if TESTING:
# As long as these apps are not ready for production, they are only available
# in development mode
INSTALLED_APPS += ["events", "bds"]
INSTALLED_APPS += ["events", "bds", "clubs"]
# ---

View file

@ -13,7 +13,7 @@ DEBUG = False
ALLOWED_HOSTS = ["cof.ens.fr", "www.cof.ens.fr", "dev.cof.ens.fr"]
if TESTING:
INSTALLED_APPS.append("events")
INSTALLED_APPS += ["events", "clubs"]
STATIC_ROOT = os.path.join(
os.path.dirname(os.path.dirname(BASE_DIR)), "public", "gestion", "static"

View file

@ -2,6 +2,7 @@
source =
bda
bds
clubs
cof
events
gestioncof
@ -36,7 +37,7 @@ default_section = THIRDPARTY
force_grid_wrap = 0
include_trailing_comma = true
known_django = django
known_first_party = bda,bds,cof,events,gestioncof,kfet,petitscours,shared,utils
known_first_party = bda,bds,clubs,cof,events,gestioncof,kfet,petitscours,shared,utils
line_length = 88
multi_line_output = 3
not_skip = __init__.py