Browse Source

Merge branch 'master' of https://dev.duhaz.fr/MrDuhaz/core

HPNL 3 months ago
parent
commit
89c071b35a
5 changed files with 32 additions and 4 deletions
  1. 9 0
      .gitignore
  2. 18 0
      migrations/0022_page_p_proteger.py
  3. 1 0
      models.py
  4. 2 2
      templates/base.html
  5. 2 2
      templates/base_no_card.html

+ 9 - 0
.gitignore

@@ -84,3 +84,12 @@ migrations/__pycache__/0018_speed_dial_sd_groupe.cpython-312.pyc
 migrations/__pycache__/0019_alter_speed_dial_sd_groupe.cpython-312.pyc
 migrations/__pycache__/0020_alter_speed_dial_sd_titre.cpython-312.pyc
 migrations/__pycache__/0021_auto_20240423_1338.cpython-312.pyc
+migrations/__pycache__/0016_groupe.cpython-39.pyc
+migrations/__pycache__/0017_groupe_g_description.cpython-39.pyc
+migrations/__pycache__/0018_speed_dial_sd_groupe.cpython-39.pyc
+migrations/__pycache__/0019_alter_speed_dial_sd_groupe.cpython-39.pyc
+migrations/__pycache__/0020_alter_speed_dial_sd_titre.cpython-39.pyc
+migrations/__pycache__/0021_auto_20240423_1338.cpython-39.pyc
+migrations/__pycache__/0022_page_p_proteger.cpython-39.pyc
+migrations/__pycache__/0022_page_p_proteger.cpython-312.pyc
+migrations/__pycache__/0023_auto_20240723_1757.cpython-312.pyc

+ 18 - 0
migrations/0022_page_p_proteger.py

@@ -0,0 +1,18 @@
+# Generated by Django 3.2.23 on 2024-07-21 18:46
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('core', '0021_auto_20240423_1338'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='page',
+            name='p_proteger',
+            field=models.BooleanField(default=False, verbose_name='Disponible que si authentifier'),
+        ),
+    ]

+ 1 - 0
models.py

@@ -102,6 +102,7 @@ class Page (models.Model) : #Architecture pour les pages static est dynamique
 	p_groupe = models.BooleanField("Afficher les groupes", default = False)
 	p_speedial = models.BooleanField("Afficher le Speedial", default = False)
 	p_publier = models.BooleanField("Publié", default = False)
+	p_proteger = models.BooleanField("Disponible que si authentifier", default = False)
 	p_see_title_and_des_in_templates = models.BooleanField("Description et titre visible dans les templates", default = True)
 
 	class Meta :

+ 2 - 2
templates/base.html

@@ -48,13 +48,13 @@
 			<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fas fa-bars" ></i> {{ p_menu_parent.grouper }}</a>
 				<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
 				{% for item in p_menu_parent.list|dictsortreversed:"p_menu_poid" %}
-					<a class="dropdown-item" {%if item.p_type == "lien_ext" %}target="_blank"{% endif %}  href="{{item.p_adresse}}">{% if item.p_icone %}<i class="{{item.p_icone}}" ></i> {% endif %}{{item.p_titre}}</a></li>
+					<a class="dropdown-item {% if item.p_proteger == True and user.is_authenticated %} {% elif item.p_proteger == False %} {% else %}disabled{% endif %}" {%if item.p_type == "lien_ext" %}target="_blank"{% endif %} href="{{item.p_adresse}}">{% if item.p_icone %}<i class="{{item.p_icone}}" ></i> {% endif %}{{item.p_titre}}</a></li>
 				{% endfor %}
 				</div>
 			</div>
 			{% else %}
 				{% for item in p_menu_parent.list %}
-					<li class="nav-item"><a class="nav-link" {%if item.p_type == "lien_ext" %}target="_blank"{% endif %}  href="{{item.p_adresse}}">{% if item.p_icone %}<i class="{{item.p_icone}}" ></i> {% endif %}{{item.p_titre}}</a></li>
+					<li class="nav-item"><a class="nav-link {% if item.p_proteger == True and user.is_authenticated %} {% elif item.p_proteger == False %} {% else %}disabled{% endif %}" {%if item.p_type == "lien_ext" %}target="_blank"{% endif %} href="{{item.p_adresse}}">{% if item.p_icone %}<i class="{{item.p_icone}}" ></i> {% endif %}{{item.p_titre}}</a></li>
 				{% endfor %}
 			{% endif %}
 		{% endfor %}

+ 2 - 2
templates/base_no_card.html

@@ -50,13 +50,13 @@
 			<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fas fa-bars" ></i> {{ p_menu_parent.grouper }}</a>
 				<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
 				{% for item in p_menu_parent.list|dictsortreversed:"p_menu_poid" %}
-					<a class="dropdown-item" {%if item.p_type == "lien_ext" %}target="_blank"{% endif %}  href="{{item.p_adresse}}">{% if item.p_icone %}<i class="{{item.p_icone}}" ></i> {% endif %}{{item.p_titre}}</a></li>
+					<a class="dropdown-item {% if item.p_proteger == True and user.is_authenticated %} {% elif item.p_proteger == False %} {% else %}disabled{% endif %}" {%if item.p_type == "lien_ext" %}target="_blank"{% endif %} href="{{item.p_adresse}}">{% if item.p_icone %}<i class="{{item.p_icone}}" ></i> {% endif %}{{item.p_titre}}</a></li>
 				{% endfor %}
 				</div>
 			</div>
 			{% else %}
 				{% for item in p_menu_parent.list %}
-					<li class="nav-item"><a class="nav-link" {%if item.p_type == "lien_ext" %}target="_blank"{% endif %}  href="{{item.p_adresse}}">{% if item.p_icone %}<i class="{{item.p_icone}}" ></i> {% endif %}{{item.p_titre}}</a></li>
+					<li class="nav-item"><a class="nav-link {% if item.p_proteger == True and user.is_authenticated %} {% elif item.p_proteger == False %} {% else %}disabled{% endif %}" {%if item.p_type == "lien_ext" %}target="_blank"{% endif %} href="{{item.p_adresse}}">{% if item.p_icone %}<i class="{{item.p_icone}}" ></i> {% endif %}{{item.p_titre}}</a></li>
 				{% endfor %}
 			{% endif %}
 		{% endfor %}