Ajout date naissance, date entrée, fonction pour membres
This commit is contained in:
		
							parent
							
								
									d39cc93133
								
							
						
					
					
						commit
						cf17495076
					
				
					 4 changed files with 42 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -20,7 +20,7 @@ class DocumentAdmin(admin.ModelAdmin):
 | 
			
		|||
 | 
			
		||||
@admin.register(Membre)
 | 
			
		||||
class MembreAdmin(admin.ModelAdmin):
 | 
			
		||||
    list_display = ["nom", "prenom", "localite", "user__email"]
 | 
			
		||||
    list_display = ["nom", "prenom", "localite", "user__email", "date_naissance"]
 | 
			
		||||
    ordering = ["nom"]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,31 @@
 | 
			
		|||
from django.db import migrations, models
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Migration(migrations.Migration):
 | 
			
		||||
 | 
			
		||||
    dependencies = [
 | 
			
		||||
        ('beesgospel', '0002_agenda_document'),
 | 
			
		||||
    ]
 | 
			
		||||
 | 
			
		||||
    operations = [
 | 
			
		||||
        migrations.AddField(
 | 
			
		||||
            model_name='membre',
 | 
			
		||||
            name='annee_entree',
 | 
			
		||||
            field=models.PositiveSmallIntegerField(blank=True, null=True),
 | 
			
		||||
        ),
 | 
			
		||||
        migrations.AddField(
 | 
			
		||||
            model_name='membre',
 | 
			
		||||
            name='date_naissance',
 | 
			
		||||
            field=models.DateField(blank=True, null=True),
 | 
			
		||||
        ),
 | 
			
		||||
        migrations.AddField(
 | 
			
		||||
            model_name='membre',
 | 
			
		||||
            name='fonction',
 | 
			
		||||
            field=models.CharField(blank=True, max_length=100, verbose_name='Fonction'),
 | 
			
		||||
        ),
 | 
			
		||||
        migrations.AddField(
 | 
			
		||||
            model_name='membre',
 | 
			
		||||
            name='courriel',
 | 
			
		||||
            field=models.EmailField(blank=True, max_length=254, verbose_name='Courriel'),
 | 
			
		||||
        ),
 | 
			
		||||
    ]
 | 
			
		||||
| 
						 | 
				
			
			@ -27,12 +27,16 @@ class Membre(models.Model):
 | 
			
		|||
    nom = models.CharField("Nom", max_length=40)
 | 
			
		||||
    prenom = models.CharField("Prénom", max_length=40)
 | 
			
		||||
    user = models.ForeignKey(User, on_delete=models.CASCADE, null=True, blank=True)
 | 
			
		||||
    fonction = models.CharField("Fonction", max_length=100, blank=True)
 | 
			
		||||
    avatar = models.ImageField("Avatar", upload_to="avatars", blank=True)
 | 
			
		||||
    rue = models.CharField("Rue", max_length=80, blank=True)
 | 
			
		||||
    npa = models.CharField("NPA", max_length=5, blank=True)
 | 
			
		||||
    localite = models.CharField("Localité", max_length=40, blank=True)
 | 
			
		||||
    tel1 = models.CharField("Tél. 1", max_length=20, blank=True)
 | 
			
		||||
    tel2 = models.CharField("Tél. 2", max_length=20, blank=True)
 | 
			
		||||
    courriel = models.EmailField("Courriel", blank=True)
 | 
			
		||||
    date_naissance = models.DateField(null=True, blank=True)
 | 
			
		||||
    annee_entree = models.PositiveSmallIntegerField(null=True, blank=True)
 | 
			
		||||
 | 
			
		||||
    def __str__(self):
 | 
			
		||||
        return f"{self.nom} {self.prenom}"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,11 +3,15 @@
 | 
			
		|||
{% block content %}
 | 
			
		||||
    <h2>Liste des membres</h2>
 | 
			
		||||
    <table class="table table-responsive">
 | 
			
		||||
        <tr><th>Nom/prénom</th><th>Fonction</th><th>Adresse</th><th>Téls.</th><th>Courriel</th><th>Date de naissance</th><th>Année d’entrée</th></tr>
 | 
			
		||||
    {% for membre in object_list %}
 | 
			
		||||
        <tr><td>{{ membre.nom }} {{ membre.prenom }}</td>
 | 
			
		||||
            <td>{{ membre.fonction }}</td>
 | 
			
		||||
            <td>{{ membre.rue }}<br>{{ membre.npa }} {{ membre.localite }}</td>
 | 
			
		||||
            <td>{{ membre.tel1 }}<br>{{ membre.tel2 }}</td>
 | 
			
		||||
            <td>{{ membre.email }}</td>
 | 
			
		||||
            <td>{{ membre.courriel }}</td>
 | 
			
		||||
            <td>{{ membre.date_naissance|date:"d.m.Y" }}</td>
 | 
			
		||||
            <td>{{ membre.annee_entree }}</td>
 | 
			
		||||
        </tr>
 | 
			
		||||
    {% endfor %}
 | 
			
		||||
    </table>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue