From 772bab84a1af9e1f435b13424658f00236c0f35b Mon Sep 17 00:00:00 2001
From: Anteunis Charles <charles.anteunis@gmail.com>
Date: Wed, 11 Dec 2019 17:53:29 +0100
Subject: [PATCH] preparation bdd sport et affichage annonces

---
 website/db.sqlite3                            | Bin 176128 -> 176128 bytes
 .../migrations/0014_auto_20191211_1752.py     |  45 ++++++++++++++++++
 website/nutriform/models.py                   |   7 +--
 .../templates/nutriform/add_annonce.html      |   2 +-
 .../templates/nutriform/annonces.html         |  15 +++++-
 .../nutriform/templates/nutriform/base.html   |   1 +
 .../nutriform/templates/nutriform/cgu.html    |  13 +++++
 .../nutriform/templates/nutriform/index.html  |   1 +
 website/nutriform/urls.py                     |   3 +-
 website/nutriform/views.py                    |   7 ++-
 10 files changed, 86 insertions(+), 8 deletions(-)
 create mode 100644 website/nutriform/migrations/0014_auto_20191211_1752.py
 create mode 100644 website/nutriform/templates/nutriform/cgu.html

diff --git a/website/db.sqlite3 b/website/db.sqlite3
index ffc03ce57c7a4ee37ce742d6e4f1dd55f0d43e04..e7c22aaee9632f18203b0095fa39414df0f19d56 100644
GIT binary patch
delta 982
zcmZp8z}4`8Yl5_(AOiz~HUk5LA_D^hBLf4&(uq38jDi~zmhdwxvFA)?7jR}`&)FO(
zpup~Euf)nAZ|#^@T2hpmmS2=>U|?txpIBOwA8%w}XlZC<Xc%v3ZfXSL=o%X78X77X
znpv3|S(zH>nVK6K8k%ihD;~}v!_D`LmH#Dw41W>-e*SL$)%>^kRr&4s`S^bEJ>0CQ
zaFEZFe-?u-M_y`qd_3H)_~L^6q7orZW^E2MF;OLEeMW>>VqRW;UUDjvxID8l<MhA;
zM&Ze}`iB^mHW~QZi5Te`m?;>VS{WHwnHuVunHU)u7;H|=b7T~OIoH_0%D`OD!py?J
zz-05beD4p69B&zT*_0UAwz4VloA71wI`U+5AK^CO`ptQU!-V}id%||51jf@GEDQ_`
z_qTt{VC0{^S+L<f|HK7?+XR^WcoZ@#i%X1itIU!M%*!ha)6I=as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*E6EiD;ac}o(La#HhB%j4rQ0v{|oow<Wakp(2bUAcovmyw0rgo$IjPdn2V4ju*s
g(Adhz^o4)Y1Qs?%{!<M6r#1^V9N?dRYCV$~0C9|-L;wH)

diff --git a/website/nutriform/migrations/0014_auto_20191211_1752.py b/website/nutriform/migrations/0014_auto_20191211_1752.py
new file mode 100644
index 0000000..fa60498
--- /dev/null
+++ b/website/nutriform/migrations/0014_auto_20191211_1752.py
@@ -0,0 +1,45 @@
+# Generated by Django 2.2.6 on 2019-12-11 16:52
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('nutriform', '0013_auto_20191206_1522'),
+    ]
+
+    operations = [
+        migrations.RemoveField(
+            model_name='sport',
+            name='intensite',
+        ),
+        migrations.RemoveField(
+            model_name='sport',
+            name='nb_seances',
+        ),
+        migrations.RemoveField(
+            model_name='sport',
+            name='type_sport',
+        ),
+        migrations.AddField(
+            model_name='sport',
+            name='activite',
+            field=models.CharField(max_length=100, null=True),
+        ),
+        migrations.AddField(
+            model_name='sport',
+            name='geoPoint',
+            field=models.CharField(max_length=100, null=True),
+        ),
+        migrations.AddField(
+            model_name='sport',
+            name='lieu',
+            field=models.CharField(max_length=100, null=True),
+        ),
+        migrations.AddField(
+            model_name='sport',
+            name='salle',
+            field=models.CharField(max_length=100, null=True),
+        ),
+    ]
diff --git a/website/nutriform/models.py b/website/nutriform/models.py
index 803d389..3b301c7 100644
--- a/website/nutriform/models.py
+++ b/website/nutriform/models.py
@@ -39,9 +39,10 @@ class Menu(models.Model):
         return self.type_menu
 
 class Sport(models.Model):
-    type_sport = models.CharField(max_length=150)
-    nb_seances = models.IntegerField()
-    intensite = models.IntegerField()
+    salle = models.CharField(max_length=100, null=True)
+    activite = models.CharField(max_length=100, null=True)
+    lieu = models.CharField(max_length=100, null=True)
+    geoPoint = models.CharField(max_length=100, null=True)
 
 MALADIES_CHOICES = [
     ('RH', 'Rhume'),
diff --git a/website/nutriform/templates/nutriform/add_annonce.html b/website/nutriform/templates/nutriform/add_annonce.html
index 8b0e975..ef2940c 100644
--- a/website/nutriform/templates/nutriform/add_annonce.html
+++ b/website/nutriform/templates/nutriform/add_annonce.html
@@ -12,7 +12,7 @@
         {% csrf_token %}
 
         {{ form }}
-
+        <br>
         <input type="submit" value="Créer">
     </form>
 </div class="container">
diff --git a/website/nutriform/templates/nutriform/annonces.html b/website/nutriform/templates/nutriform/annonces.html
index 588811d..3b1eaf5 100644
--- a/website/nutriform/templates/nutriform/annonces.html
+++ b/website/nutriform/templates/nutriform/annonces.html
@@ -8,9 +8,22 @@
         <h2>Participez à des activités sportives communautaires</h2>
     </header>
   
+    <div class="row uniform center">
     {% for annonce in annonces_list %}
-    <a href="{% url 'detail_annonce' annonce.id %}">{{ annonce.get_type_annonce_display }} - {{ annonce.sport }} - {{ annonce.orga.username }}</a>
+    <div class="6u 12u$(xsmall)">
+        <ul style="list-style: none;">
+            <li>{{ annonce.get_type_annonce_display }}</li>
+            <li><i>{{ annonce.date }}</i></li>
+            <li>{{ annonce.sport }}</li>
+            <li>{{ annonce.ville }}</li>
+            <li>{{ annonce.description }}</li>
+        </ul>
+        {% if user.is_authenticated and user != annonce.orga %}
+        <a href="mailto:{{annonce.orga.email}}" class="button">Contacter l'organisateur</a>
+        {% endif %}
+    </div>
     {% endfor %}
+    </div>
     <br>
     <a href="{% url 'add_annonce' %}" class="button">Créer mon annonce</a>
 </div class="container">
diff --git a/website/nutriform/templates/nutriform/base.html b/website/nutriform/templates/nutriform/base.html
index 56cec4b..13929d7 100644
--- a/website/nutriform/templates/nutriform/base.html
+++ b/website/nutriform/templates/nutriform/base.html
@@ -54,6 +54,7 @@
 				<li>&copy; NutriForm</li>
 				<li>Design: <a href="http://templated.co">TEMPLATED</a></li>
 				<li>Images: <a href="http://unsplash.com">Unsplash</a></li>
+				<li><a href="{% url 'cgu' %}">Conditions générales d'utlisation</a></li>
 			</ul>
 		</div>
 	</footer>
diff --git a/website/nutriform/templates/nutriform/cgu.html b/website/nutriform/templates/nutriform/cgu.html
new file mode 100644
index 0000000..4f10764
--- /dev/null
+++ b/website/nutriform/templates/nutriform/cgu.html
@@ -0,0 +1,13 @@
+{% extends "../nutriform/base.html" %}
+
+{% block content %}
+
+<div class="container">
+
+    <header class="major">
+        <h2>Conditions générales d'utilisation</h2>
+    </header>
+    
+    
+</div class="container">
+{% endblock %}
\ No newline at end of file
diff --git a/website/nutriform/templates/nutriform/index.html b/website/nutriform/templates/nutriform/index.html
index dc3c2b3..b09c833 100644
--- a/website/nutriform/templates/nutriform/index.html
+++ b/website/nutriform/templates/nutriform/index.html
@@ -221,6 +221,7 @@
 				<li>&copy; NutriForm</li>
 				<li>Design: <a href="http://templated.co">NutriForm_Design</a></li>
 				<li>Images: <a href="http://unsplash.com">Unsplash</a></li>
+				<li><a href="{% url 'cgu' %}">Conditions générales d'utilisation</a></li>
 			</ul>
 		</div>
 	</footer>
diff --git a/website/nutriform/urls.py b/website/nutriform/urls.py
index f8d9963..365eae8 100644
--- a/website/nutriform/urls.py
+++ b/website/nutriform/urls.py
@@ -16,5 +16,6 @@ urlpatterns = [
 	path('accounts/profile/modification_infos/', views.modif_infos, name='modif_info'),
 	path('annonces/créer/', views.addAnnnonce, name='add_annonce'),
 	path('annonces/<int:annonce_id>/', views.detail_annonce, name='detail_annonce'),
-	path('annonces/', views.annonces, name='annonces')
+	path('annonces/', views.annonces, name='annonces'),
+	path('cgu/', views.cgu, name='cgu')
 ]
diff --git a/website/nutriform/views.py b/website/nutriform/views.py
index ea6e36e..4fd7c91 100644
--- a/website/nutriform/views.py
+++ b/website/nutriform/views.py
@@ -205,7 +205,7 @@ def addAnnnonce(request):
 			annonce = form.save()
 			annonce.orga = request.user
 			annonce.save()
-			return redirect('compte')
+			return redirect('annonces')
 
 	else :
 		form = AnnonceForm()
@@ -213,4 +213,7 @@ def addAnnnonce(request):
 	context = {
 		'form':form,
 	}
-	return render(request, 'nutriform/add_annonce.html', context)
\ No newline at end of file
+	return render(request, 'nutriform/add_annonce.html', context)
+
+def cgu(request):
+	return render(request, 'nutriform/cgu.html')
\ No newline at end of file
-- 
GitLab