Parcourir la source

route pour django v5.*

Mr Duhaz il y a 1 mois
Parent
commit
06aa4b86db
3 fichiers modifiés avec 44 ajouts et 23 suppressions
  1. 31 0
      .gitignore
  2. 1 1
      admin.py
  3. 12 22
      models.py

+ 31 - 0
.gitignore

@@ -99,3 +99,34 @@ migrations/__pycache__/0024_auto_20240730_2235.cpython-39.pyc
 migrations/__pycache__/0024_auto_20240730_2235.cpython-312.pyc
 migrations/__pycache__/0025_auto_20240730_2241.cpython-39.pyc
 migrations/__pycache__/0025_auto_20240730_2241.cpython-312.pyc
+__pycache__/__init__.cpython-313.pyc
+__pycache__/admin.cpython-313.pyc
+__pycache__/apps.cpython-313.pyc
+__pycache__/models.cpython-313.pyc
+__pycache__/views.cpython-313.pyc
+migrations/__pycache__/__init__.cpython-313.pyc
+migrations/__pycache__/0001_initial.cpython-313.pyc
+migrations/__pycache__/0002_auto_20220422_0914.cpython-313.pyc
+migrations/__pycache__/0003_data.cpython-313.pyc
+migrations/__pycache__/0004_auto_20221121_1234.cpython-313.pyc
+migrations/__pycache__/0005_page_p_menu_stack.cpython-313.pyc
+migrations/__pycache__/0006_speed_dial.cpython-313.pyc
+migrations/__pycache__/0007_auto_20231201_1455.cpython-313.pyc
+migrations/__pycache__/0008_speed_dial_sd_icone.cpython-313.pyc
+migrations/__pycache__/0009_speed_dial_sd_color.cpython-313.pyc
+migrations/__pycache__/0010_auto_20231222_1114.cpython-313.pyc
+migrations/__pycache__/0011_alter_page_p_menu_parent.cpython-313.pyc
+migrations/__pycache__/0012_page_p_menu_est_parent.cpython-313.pyc
+migrations/__pycache__/0013_alter_page_p_menu_parent.cpython-313.pyc
+migrations/__pycache__/0014_fichier.cpython-313.pyc
+migrations/__pycache__/0015_auto_20240119_1346.cpython-313.pyc
+migrations/__pycache__/0016_groupe.cpython-313.pyc
+migrations/__pycache__/0017_groupe_g_description.cpython-313.pyc
+migrations/__pycache__/0018_speed_dial_sd_groupe.cpython-313.pyc
+migrations/__pycache__/0019_alter_speed_dial_sd_groupe.cpython-313.pyc
+migrations/__pycache__/0020_alter_speed_dial_sd_titre.cpython-313.pyc
+migrations/__pycache__/0021_auto_20240423_1338.cpython-313.pyc
+migrations/__pycache__/0022_page_p_proteger.cpython-313.pyc
+migrations/__pycache__/0023_auto_20240730_2056.cpython-313.pyc
+migrations/__pycache__/0024_auto_20240730_2235.cpython-313.pyc
+migrations/__pycache__/0025_auto_20240730_2241.cpython-313.pyc

+ 1 - 1
admin.py

@@ -30,7 +30,7 @@ def bt_sd_poid_moin(modeladmin, request, queryset):
 bt_sd_poid_moin.short_description = "Diminuer le poid de 5"
 
 class Page_Admin(admin.ModelAdmin):
-	form = Page_Admin_Form
+	form = Page_Admin_Form  # Réactivé
 	list_display = ('p_titre', 'p_titre_slugify', 'p_adresse', 'p_contenu', 'p_right', 'p_type', 'p_menu_poid', 'p_publier','p_see_title_and_des_in_templates')
 	list_filter = ('p_type', 'p_menu_parent', 'p_publier', 'p_see_title_and_des_in_templates')
 	actions = [bt_p_menu_poid_plus, bt_p_menu_poid_moin, bt_p_publier, bt_p_not_publier]

+ 12 - 22
models.py

@@ -3,7 +3,7 @@ from django import forms
 
 from django.template.defaultfilters import slugify
 
-from trumbowyg.widgets import TrumbowygWidget
+from tinymce.widgets import TinyMCE  # Réactivé
 
 menu_pos = (
 	(u'no', u'No'),
@@ -45,11 +45,9 @@ class Groupe (models.Model) : #group pour organisation
 		verbose_name = 'Groupe'
 		verbose_name_plural = 'Groupes'
 
-	def save(self, *args, **kwargs) :
+	def save(self, *args, **kwargs):
 		self.g_nom_slugify = slugify(self.g_nom)
-		super(Groupe, self).save(*args, **kwargs)
-	def __unicode__(self):
-		return self.g_nom
+		super().save(*args, **kwargs)  # Python 3 moderne
 	def __str__(self):
 		return '%s' % (self.g_nom)
 
@@ -64,12 +62,10 @@ class Data (models.Model) : #stocage de donnée dynamique
 		verbose_name_plural = 'Stocage de données'
 		ordering = ['d_titre']
 
-	def save(self, *args, **kwargs) :
+	def save(self, *args, **kwargs):
 		self.d_titre_slugify = slugify(self.d_titre)
-		super(Data, self).save(*args, **kwargs)
+		super().save(*args, **kwargs)  # Python 3 moderne
 
-	def __unicode__(self):
-		return self.d_titre
 	def __str__(self):
 		return '%s' % (self.d_titre)
 	
@@ -83,11 +79,9 @@ class Fichier (models.Model) : # Upload de fichier pour réutilisation dans les
 		verbose_name_plural = 'Stocage de fichiers'
 		ordering = ['f_date']
 
-	def save(self, *args, **kwargs) :
+	def save(self, *args, **kwargs):
 		self.f_nom = slugify(self.f_fichier.name)
-		super(Fichier, self).save(*args, **kwargs)
-	def __unicode__(self):
-		return self.f_nom
+		super().save(*args, **kwargs)  # Python 3 moderne
 	def __str__(self):
 		return '%s' % (self.f_nom)
 
@@ -128,10 +122,8 @@ class Page (models.Model) : #Architecture pour les pages static est dynamique
 			self.p_description = "."
 			self.p_contenu = "."
 
-		super(Page, self).save(*args, **kwargs)
+		super().save(*args, **kwargs)  # Python 3 moderne
 
-	def __unicode__(self):
-		return self.p_titre
 	def __str__(self):
 		return '%s' % (self.p_titre)
 	
@@ -167,8 +159,6 @@ class Contact (models.Model): # model de contact et retour de bug
 	c_description = models.TextField("Votre demande")
 	c_statut = models.CharField("Statut de la demande", max_length=16, choices=c_statut_liste, default = 'non_lu')
 
-	def __unicode__(self):
-		return self.c_name
 	def __str__(self):
 		return '%s' % (self.c_name)
 
@@ -177,12 +167,12 @@ class ContactForm(forms.ModelForm):# formulaire de contact lié au model
 		model = Contact
 		fields = ['c_name', 'c_email', 'c_type', 'c_description']
 
-class Page_Admin_Form(forms.ModelForm):
+class Page_Admin_Form(forms.ModelForm):  # Réactivé
 	class Meta:
 		model = Page
 		exclude = ['p_titre_slugify']
 		widgets = {
-			'p_contenu': TrumbowygWidget(),
-			'p_right': TrumbowygWidget(),
-			}
+			'p_contenu': TinyMCE(),
+			'p_right': TinyMCE(),
+		}