black puis isort

This commit is contained in:
Maurice Debray 2022-03-15 01:08:18 +01:00
parent 14e8d963d6
commit 7122c1c0c4
6 changed files with 40 additions and 20 deletions

View file

@ -2,10 +2,22 @@ from django.contrib import admin
from .models import Event, Participants from .models import Event, Participants
class ParticipantsAdmin(admin.ModelAdmin): class ParticipantsAdmin(admin.ModelAdmin):
fields = ["event", "participant", "reponse", "instrument", "instrument_autre", "dont_play_main", "details", "creationDate", "updateDate" ] fields = [
readonly_fields = [ "creationDate", "updateDate" ] "event",
list_display = ["participant", "event", "reponse", "creationDate", "updateDate" ] "participant",
"reponse",
"instrument",
"instrument_autre",
"dont_play_main",
"details",
"creationDate",
"updateDate",
]
readonly_fields = ["creationDate", "updateDate"]
list_display = ["participant", "event", "reponse", "creationDate", "updateDate"]
# Add event by admin page return a 502 error # Add event by admin page return a 502 error
admin.site.register(Event) admin.site.register(Event)

View file

@ -1,8 +1,8 @@
from django import forms from django import forms
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from gestion.models import ErnestoUser
from calendrier.models import Event, Participants from calendrier.models import Event, Participants
from gestion.models import ErnestoUser
class ModifEventForm(forms.ModelForm): class ModifEventForm(forms.ModelForm):

View file

@ -1,25 +1,31 @@
# Generated by Django 2.2.25 on 2022-03-14 23:20 # Generated by Django 2.2.25 on 2022-03-14 23:20
from django.db import migrations, models
import django.utils.timezone import django.utils.timezone
from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('calendrier', '0006_auto_20210929_1629'), ("calendrier", "0006_auto_20210929_1629"),
] ]
operations = [ operations = [
migrations.AddField( migrations.AddField(
model_name='participants', model_name="participants",
name='creationDate', name="creationDate",
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now, verbose_name='Date de création'), field=models.DateTimeField(
auto_now_add=True,
default=django.utils.timezone.now,
verbose_name="Date de création",
),
preserve_default=False, preserve_default=False,
), ),
migrations.AddField( migrations.AddField(
model_name='participants', model_name="participants",
name='updateDate', name="updateDate",
field=models.DateTimeField(auto_now=True, verbose_name='Dernière mise à jour'), field=models.DateTimeField(
auto_now=True, verbose_name="Dernière mise à jour"
),
), ),
] ]

View file

@ -2,7 +2,6 @@ import uuid
from django.db import models from django.db import models
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from gestion.models import INSTRU_CHOICES, ErnestoUser from gestion.models import INSTRU_CHOICES, ErnestoUser
ANSWERS = ( ANSWERS = (
@ -73,5 +72,9 @@ class Participants(models.Model):
choices=[("Non", _("Non")), ("Oui", _("Oui"))], choices=[("Non", _("Non")), ("Oui", _("Oui"))],
) )
details = models.CharField(max_length=50, blank=True) details = models.CharField(max_length=50, blank=True)
creationDate = models.DateTimeField(auto_now_add=True, verbose_name = _("Date de création")) creationDate = models.DateTimeField(
updateDate = models.DateTimeField(auto_now=True, verbose_name = _("Dernière mise à jour")) auto_now_add=True, verbose_name=_("Date de création")
)
updateDate = models.DateTimeField(
auto_now=True, verbose_name=_("Dernière mise à jour")
)

View file

@ -4,7 +4,6 @@ from django.contrib.auth import get_user_model
from django.template.defaultfilters import urlencode from django.template.defaultfilters import urlencode
from django.test import Client, TestCase from django.test import Client, TestCase
from django.utils import timezone from django.utils import timezone
from gestion.models import ErnestoUser from gestion.models import ErnestoUser
from ..models import Event from ..models import Event

View file

@ -4,20 +4,20 @@ from calendar import monthrange
from collections import defaultdict from collections import defaultdict
from datetime import date, datetime from datetime import date, datetime
from actu.models import Actu
from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib.auth.mixins import LoginRequiredMixin
from django.db.models import Q from django.db.models import Q
from django.shortcuts import get_object_or_404, redirect, render from django.shortcuts import get_object_or_404, redirect, render
from django.urls import reverse, reverse_lazy from django.urls import reverse, reverse_lazy
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from django.views.generic import DeleteView, TemplateView, UpdateView from django.views.generic import DeleteView, TemplateView, UpdateView
from gestion.mixins import ChefEventRequiredMixin, ChefRequiredMixin
from gestion.models import Photo
from actu.models import Actu
from calendrier.calend import EventCalendar from calendrier.calend import EventCalendar
from calendrier.forms import (ChangeDoodleName, EventForm, ModifEventForm, from calendrier.forms import (ChangeDoodleName, EventForm, ModifEventForm,
ParticipantsForm) ParticipantsForm)
from calendrier.models import Event, Participants from calendrier.models import Event, Participants
from gestion.mixins import ChefEventRequiredMixin, ChefRequiredMixin
from gestion.models import Photo
def generer(*args): def generer(*args):
@ -379,7 +379,7 @@ class ReponseEvent(LoginRequiredMixin, TemplateView):
p = Participants.objects.get(event=ev, participant=part) p = Participants.objects.get(event=ev, participant=part)
except Participants.DoesNotExist: except Participants.DoesNotExist:
p = None p = None
form = self.form_class(request.POST, instance = p) form = self.form_class(request.POST, instance=p)
if form.is_valid(): if form.is_valid():
obj = form.save(commit=False) obj = form.save(commit=False)
# Si la participation existe déjà, ces 2 ligne sont redondantes # Si la participation existe déjà, ces 2 ligne sont redondantes