Ajout catégorie de documents
This commit is contained in:
		
							parent
							
								
									5d50953482
								
							
						
					
					
						commit
						c376aea787
					
				
					 3 changed files with 26 additions and 1 deletions
				
			
		| 
						 | 
					@ -14,7 +14,8 @@ class AgendaAdmin(admin.ModelAdmin):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@admin.register(Document)
 | 
					@admin.register(Document)
 | 
				
			||||||
class DocumentAdmin(admin.ModelAdmin):
 | 
					class DocumentAdmin(admin.ModelAdmin):
 | 
				
			||||||
    list_display = ["titre", "quand", "prive"]
 | 
					    list_display = ["titre", "quand", "categorie", "prive"]
 | 
				
			||||||
 | 
					    list_filter = ["categorie"]
 | 
				
			||||||
    ordering = ["-quand"]
 | 
					    ordering = ["-quand"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										17
									
								
								beesgospel/migrations/0004_document_categorie.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								beesgospel/migrations/0004_document_categorie.py
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,17 @@
 | 
				
			||||||
 | 
					from django.db import migrations, models
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class Migration(migrations.Migration):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    dependencies = [
 | 
				
			||||||
 | 
					        ('beesgospel', '0003_membre_annee_entree_date_naissance'),
 | 
				
			||||||
 | 
					    ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    operations = [
 | 
				
			||||||
 | 
					        migrations.AddField(
 | 
				
			||||||
 | 
					            model_name='document',
 | 
				
			||||||
 | 
					            name='categorie',
 | 
				
			||||||
 | 
					            field=models.CharField(choices=[('video', 'Vidéo'), ('audio', 'Audio'), ('photos', 'Photos'), ('doc', 'Document')], default='doc', max_length=30, verbose_name='Catégorie'),
 | 
				
			||||||
 | 
					            preserve_default=False,
 | 
				
			||||||
 | 
					        ),
 | 
				
			||||||
 | 
					    ]
 | 
				
			||||||
| 
						 | 
					@ -63,11 +63,18 @@ class Agenda(models.Model):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Document(models.Model):
 | 
					class Document(models.Model):
 | 
				
			||||||
 | 
					    class Categories(models.TextChoices):
 | 
				
			||||||
 | 
					        VIDEO = "video", "Vidéo"
 | 
				
			||||||
 | 
					        AUDIO = "audio", "Audio"
 | 
				
			||||||
 | 
					        PHOTOS = "photos", "Photos"
 | 
				
			||||||
 | 
					        DOCUMENT = "doc", "Document"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fichier = models.FileField("Fichier", upload_to="documents", blank=True)
 | 
					    fichier = models.FileField("Fichier", upload_to="documents", blank=True)
 | 
				
			||||||
    url = models.URLField("URL", blank=True)
 | 
					    url = models.URLField("URL", blank=True)
 | 
				
			||||||
    quand = models.DateField("Date")
 | 
					    quand = models.DateField("Date")
 | 
				
			||||||
    titre = models.CharField("Titre", max_length=150)
 | 
					    titre = models.CharField("Titre", max_length=150)
 | 
				
			||||||
    infos = models.TextField("Infos", blank=True)
 | 
					    infos = models.TextField("Infos", blank=True)
 | 
				
			||||||
 | 
					    categorie = models.CharField("Catégorie", max_length=30, choices=Categories)
 | 
				
			||||||
    prive = models.BooleanField(
 | 
					    prive = models.BooleanField(
 | 
				
			||||||
        "Privé", default=False, help_text=(
 | 
					        "Privé", default=False, help_text=(
 | 
				
			||||||
            "Un document privé ne peut être consulté que par les membres de "
 | 
					            "Un document privé ne peut être consulté que par les membres de "
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue