diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 081f023..c20e809 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,22 +1,37 @@ -image: python:3.8 - stages: - test + - quality-assurance -before_script: - - pip install tox - -python37: - image: python:3.7 +py37-django22: stage: test + image: debian:buster-backports + before_script: + - > + apt-get update && + apt-get install --no-install-recommends -t buster-backports -y + python3-django python3-django-casclient python3-django-reversion python3-djangorestframework + python3-docutils python3-pil python3-tz python3-six python3-sqlparse python3-stdnum python3-yaml python3-coreapi tox script: tox -e py37 -python38: - image: python:3.8 +py38-django22: stage: test - script: tox -e py37 + image: ubuntu:20.04 + before_script: + # Fix tzdata prompt + - ln -sf /usr/share/zoneinfo/Europe/Paris /etc/localtime && echo Europe/Paris > /etc/timezone + - > + apt-get update && + apt-get install --no-install-recommends -y + python3-django python3-django-casclient python3-django-reversion python3-djangorestframework + python3-docutils python3-pil python3-tz python3-six python3-sqlparse python3-stdnum python3-yaml python3-coreapi tox + script: tox -e py38 linters: - stage: test + stage: quality-assurance + image: debian:buster-backports + before_script: + - apt-get update && apt-get install -y tox script: tox -e linters + + # Be nice to new contributors, but please use `tox` allow_failure: true diff --git a/README.md b/README.md index 475c1f3..3810be9 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,8 @@ chmod go-rwx -R django-med python3 -m venv venv --system-site-packages . venv/bin/activate pip install -r requirements.txt +pip install mysqlclient~=1.4.0 # si base MySQL +pip install uwsgi~=2.0.18 # si production ./entrypoint.sh # lance en shell ``` diff --git a/media/admin.py b/media/admin.py index 0a832e3..6ea0bd4 100644 --- a/media/admin.py +++ b/media/admin.py @@ -6,6 +6,7 @@ from django.urls import reverse from django.utils.html import format_html from django.utils.translation import ugettext_lazy as _ from reversion.admin import VersionAdmin + from med.admin import admin_site from .forms import MediaAdminForm diff --git a/media/migrations/0038_auto_20200923_2030.py b/media/migrations/0038_auto_20200923_2030.py new file mode 100644 index 0000000..07d7ee4 --- /dev/null +++ b/media/migrations/0038_auto_20200923_2030.py @@ -0,0 +1,55 @@ +# Generated by Django 2.2.12 on 2020-09-23 18:30 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('media', '0037_revue_double'), + ] + + operations = [ + migrations.AlterField( + model_name='bd', + name='external_url', + field=models.URLField(blank=True, default='', verbose_name='external URL'), + preserve_default=False, + ), + migrations.AlterField( + model_name='bd', + name='subtitle', + field=models.CharField(blank=True, default='', max_length=255, verbose_name='subtitle'), + preserve_default=False, + ), + migrations.AlterField( + model_name='jeu', + name='comment', + field=models.CharField(blank=True, default='', max_length=255, verbose_name='comment'), + preserve_default=False, + ), + migrations.AlterField( + model_name='manga', + name='external_url', + field=models.URLField(blank=True, default='', verbose_name='external URL'), + preserve_default=False, + ), + migrations.AlterField( + model_name='manga', + name='subtitle', + field=models.CharField(blank=True, default='', max_length=255, verbose_name='subtitle'), + preserve_default=False, + ), + migrations.AlterField( + model_name='roman', + name='external_url', + field=models.URLField(blank=True, default='', verbose_name='external URL'), + preserve_default=False, + ), + migrations.AlterField( + model_name='roman', + name='subtitle', + field=models.CharField(blank=True, default='', max_length=255, verbose_name='subtitle'), + preserve_default=False, + ), + ] diff --git a/media/models.py b/media/models.py index d6df7ba..eb40416 100644 --- a/media/models.py +++ b/media/models.py @@ -48,13 +48,11 @@ class BD(models.Model): verbose_name=_('subtitle'), max_length=255, blank=True, - null=True, ) external_url = models.URLField( verbose_name=_('external URL'), blank=True, - null=True, ) side_identifier = models.CharField( @@ -109,13 +107,11 @@ class Manga(models.Model): verbose_name=_('subtitle'), max_length=255, blank=True, - null=True, ) external_url = models.URLField( verbose_name=_('external URL'), blank=True, - null=True, ) side_identifier = models.CharField( @@ -167,13 +163,11 @@ class Roman(models.Model): verbose_name=_('subtitle'), max_length=255, blank=True, - null=True, ) external_url = models.URLField( verbose_name=_('external URL'), blank=True, - null=True, ) side_identifier = models.CharField( @@ -415,7 +409,6 @@ class Jeu(models.Model): comment = models.CharField( max_length=255, blank=True, - null=True, verbose_name=_('comment'), ) diff --git a/requirements.txt b/requirements.txt index 8b17ee6..3d52ddc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ Django~=2.2.10 docutils~=0.14 -Pillow~=5.4.1 +Pillow>=5.4.1 pytz~=2019.1 six~=1.12.0 sqlparse~=0.2.4 @@ -10,5 +10,3 @@ python-stdnum~=1.10 djangorestframework~=3.9.0 pyyaml~=3.13 coreapi~=2.3.3 -uwsgi~=2.0.18 -mysqlclient~=1.4.0 diff --git a/users/migrations/0041_auto_20200923_2030.py b/users/migrations/0041_auto_20200923_2030.py new file mode 100644 index 0000000..e9db553 --- /dev/null +++ b/users/migrations/0041_auto_20200923_2030.py @@ -0,0 +1,25 @@ +# Generated by Django 2.2.12 on 2020-09-23 18:30 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('users', '0040_delete_clef'), + ] + + operations = [ + migrations.AlterField( + model_name='user', + name='address', + field=models.CharField(blank=True, default='', max_length=255, verbose_name='address'), + preserve_default=False, + ), + migrations.AlterField( + model_name='user', + name='telephone', + field=models.CharField(blank=True, default='', max_length=15, verbose_name='phone number'), + preserve_default=False, + ), + ] diff --git a/users/models.py b/users/models.py index bdd5092..acea90d 100644 --- a/users/models.py +++ b/users/models.py @@ -13,13 +13,11 @@ class User(AbstractUser): telephone = models.CharField( verbose_name=_('phone number'), max_length=15, - null=True, blank=True, ) address = models.CharField( verbose_name=_('address'), max_length=255, - null=True, blank=True, ) maxemprunt = models.IntegerField( @@ -69,3 +67,6 @@ class Adhesion(models.Model): class Meta: verbose_name = _('membership year') verbose_name_plural = _('membership years') + + def __str__(self): + return f"{self.starting_in} - {self.ending_in}"