Quellcode durchsuchen

change wiki order

HPNL vor 8 Monaten
Ursprung
Commit
1dabc1e9d7
5 geänderte Dateien mit 48 neuen und 6 gelöschten Zeilen
  1. 2 0
      .gitignore
  2. 18 0
      migrations/0005_alter_wiki_w_publdate.py
  3. 22 0
      migrations/0006_auto_20240313_1057.py
  4. 1 1
      models.py
  5. 5 5
      views.py

+ 2 - 0
.gitignore

@@ -13,3 +13,5 @@ migrations/__pycache__/0004_auto_20240123_1644.cpython-312.pyc
 migrations/__pycache__/0005_auto_20240123_1658.cpython-312.pyc
 migrations/__pycache__/0006_auto_20240124_0910.cpython-312.pyc
 migrations/__pycache__/0007_remove_wiki_w_data.cpython-312.pyc
+migrations/__pycache__/0005_alter_wiki_w_publdate.cpython-312.pyc
+migrations/__pycache__/0006_auto_20240313_1057.cpython-312.pyc

+ 18 - 0
migrations/0005_alter_wiki_w_publdate.py

@@ -0,0 +1,18 @@
+# Generated by Django 3.2.23 on 2024-03-13 10:54
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('wiki', '0004_alter_wiki_w_contenu'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='wiki',
+            name='w_publdate',
+            field=models.DateTimeField(auto_now=True, verbose_name='Mise à jour le'),
+        ),
+    ]

+ 22 - 0
migrations/0006_auto_20240313_1057.py

@@ -0,0 +1,22 @@
+# Generated by Django 3.2.23 on 2024-03-13 10:57
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('wiki', '0005_alter_wiki_w_publdate'),
+    ]
+
+    operations = [
+        migrations.AlterModelOptions(
+            name='wiki',
+            options={'ordering': ['w_titre'], 'verbose_name': 'Gestion du Wiki', 'verbose_name_plural': 'Gestion du Wiki'},
+        ),
+        migrations.AlterField(
+            model_name='wiki',
+            name='w_publdate',
+            field=models.DateTimeField(auto_now_add=True, verbose_name='Mise à jour le'),
+        ),
+    ]

+ 1 - 1
models.py

@@ -36,7 +36,7 @@ class Wiki(models.Model) : #Architecture pour le Wiki
 	class Meta :
 		verbose_name = 'Gestion du Wiki'
 		verbose_name_plural = 'Gestion du Wiki'
-		ordering = ['-w_publdate']
+		ordering = ['w_titre']
 
 	def save(self, *args, **kwargs) :
 		self.w_titre_slugify = slugify(self.w_titre)

+ 5 - 5
views.py

@@ -41,19 +41,19 @@ def wiki_index(request, cat):
 		page.wiki_search = Wiki_search_Form()
 	if cat == "index":
 		if w_search != None:
-			wiki_art = Wiki.objects.filter( w_publier = True ).filter(q).order_by( '-w_publdate' )
+			wiki_art = Wiki.objects.filter( w_publier = True ).filter(q).order_by( 'w_titre' )
 		else :
-			wiki_art = Wiki.objects.filter( w_publier = True ).order_by( '-w_publdate' )
+			wiki_art = Wiki.objects.filter( w_publier = True ).order_by( 'w_titre' )
 		page.wiki_cat = Cat_Wiki.objects.all()[:15]
 
 	elif cat == "all":
-		wiki_art = Wiki.objects.filter( w_publier = True ).order_by( '-w_publdate' )
+		wiki_art = Wiki.objects.filter( w_publier = True ).order_by( 'w_titre' )
 		page.wiki_cat = Cat_Wiki.objects.all()[:15]
 	else :
 		if w_search != None:
-			wiki_art = Wiki.objects.filter( w_publier = True ).filter( w_cat__cw_titre_slgify = cat ).filter(q).order_by( '-w_publdate' )
+			wiki_art = Wiki.objects.filter( w_publier = True ).filter( w_cat__cw_titre_slgify = cat ).filter(q).order_by( 'w_titre' )
 		else :
-			wiki_art = Wiki.objects.filter( w_publier = True ).filter( w_cat__cw_titre_slgify = cat ).order_by( '-w_publdate' )
+			wiki_art = Wiki.objects.filter( w_publier = True ).filter( w_cat__cw_titre_slgify = cat ).order_by( 'w_titre' )
 		page.wiki_cat = Cat_Wiki.objects.filter( cw_titre_slgify = cat )[:15]
 		page.retour = "wiki_index"