From ca7877ebe668e43012465a35db43b8e9269a8d78 Mon Sep 17 00:00:00 2001
From: senza <maximesenzamici@gmail.com>
Date: Fri, 24 Jul 2020 00:35:11 +0200
Subject: [PATCH] form models & migrations

---
 .../migrations/0002_auto_20200617_1440.py     | 55 +++++++++++++++++++
 .../migrations/0003_poll_debate.py            | 21 +++++++
 .../migrations/0004_remove_poll_debate.py     | 19 +++++++
 .../migrations/0005_poll_startdate.py         | 20 +++++++
 .../migrations/0006_auto_20200723_1139.py     | 25 +++++++++
 .../migrations/0007_auto_20200723_2133.py     | 20 +++++++
 djangoldp_polls/models.py                     |  9 ++-
 7 files changed, 166 insertions(+), 3 deletions(-)
 create mode 100644 djangoldp_polls/migrations/0002_auto_20200617_1440.py
 create mode 100644 djangoldp_polls/migrations/0003_poll_debate.py
 create mode 100644 djangoldp_polls/migrations/0004_remove_poll_debate.py
 create mode 100644 djangoldp_polls/migrations/0005_poll_startdate.py
 create mode 100644 djangoldp_polls/migrations/0006_auto_20200723_1139.py
 create mode 100644 djangoldp_polls/migrations/0007_auto_20200723_2133.py

diff --git a/djangoldp_polls/migrations/0002_auto_20200617_1440.py b/djangoldp_polls/migrations/0002_auto_20200617_1440.py
new file mode 100644
index 0000000..1284915
--- /dev/null
+++ b/djangoldp_polls/migrations/0002_auto_20200617_1440.py
@@ -0,0 +1,55 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.29 on 2020-06-17 14:40
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('djangoldp_polls', '0001_initial'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='poll',
+            name='allow_create_backlink',
+            field=models.BooleanField(default=True, help_text='set to False to disable backlink creation after Model save'),
+        ),
+        migrations.AddField(
+            model_name='poll',
+            name='is_backlink',
+            field=models.BooleanField(default=False, help_text='(DEPRECIATED) set automatically to indicate the Model is a backlink'),
+        ),
+        migrations.AddField(
+            model_name='polloption',
+            name='allow_create_backlink',
+            field=models.BooleanField(default=True, help_text='set to False to disable backlink creation after Model save'),
+        ),
+        migrations.AddField(
+            model_name='polloption',
+            name='is_backlink',
+            field=models.BooleanField(default=False, help_text='(DEPRECIATED) set automatically to indicate the Model is a backlink'),
+        ),
+        migrations.AddField(
+            model_name='tag',
+            name='allow_create_backlink',
+            field=models.BooleanField(default=True, help_text='set to False to disable backlink creation after Model save'),
+        ),
+        migrations.AddField(
+            model_name='tag',
+            name='is_backlink',
+            field=models.BooleanField(default=False, help_text='(DEPRECIATED) set automatically to indicate the Model is a backlink'),
+        ),
+        migrations.AddField(
+            model_name='vote',
+            name='allow_create_backlink',
+            field=models.BooleanField(default=True, help_text='set to False to disable backlink creation after Model save'),
+        ),
+        migrations.AddField(
+            model_name='vote',
+            name='is_backlink',
+            field=models.BooleanField(default=False, help_text='(DEPRECIATED) set automatically to indicate the Model is a backlink'),
+        ),
+    ]
diff --git a/djangoldp_polls/migrations/0003_poll_debate.py b/djangoldp_polls/migrations/0003_poll_debate.py
new file mode 100644
index 0000000..4884f45
--- /dev/null
+++ b/djangoldp_polls/migrations/0003_poll_debate.py
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.29 on 2020-07-01 08:35
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('djangoldp_conversation', '0006_auto_20200617_1309'),
+        ('djangoldp_polls', '0002_auto_20200617_1440'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='poll',
+            name='debate',
+            field=models.ManyToManyField(blank=True, related_name='debate', to='djangoldp_conversation.Conversation'),
+        ),
+    ]
diff --git a/djangoldp_polls/migrations/0004_remove_poll_debate.py b/djangoldp_polls/migrations/0004_remove_poll_debate.py
new file mode 100644
index 0000000..592ff7a
--- /dev/null
+++ b/djangoldp_polls/migrations/0004_remove_poll_debate.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.29 on 2020-07-01 08:35
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('djangoldp_polls', '0003_poll_debate'),
+    ]
+
+    operations = [
+        migrations.RemoveField(
+            model_name='poll',
+            name='debate',
+        ),
+    ]
diff --git a/djangoldp_polls/migrations/0005_poll_startdate.py b/djangoldp_polls/migrations/0005_poll_startdate.py
new file mode 100644
index 0000000..5fc0881
--- /dev/null
+++ b/djangoldp_polls/migrations/0005_poll_startdate.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.29 on 2020-07-23 10:40
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('djangoldp_polls', '0004_remove_poll_debate'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='poll',
+            name='startDate',
+            field=models.DateField(blank=True, null=True, verbose_name='Date de début'),
+        ),
+    ]
diff --git a/djangoldp_polls/migrations/0006_auto_20200723_1139.py b/djangoldp_polls/migrations/0006_auto_20200723_1139.py
new file mode 100644
index 0000000..c792742
--- /dev/null
+++ b/djangoldp_polls/migrations/0006_auto_20200723_1139.py
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.29 on 2020-07-23 11:39
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('djangoldp_polls', '0005_poll_startdate'),
+    ]
+
+    operations = [
+        migrations.RemoveField(
+            model_name='tag',
+            name='name',
+        ),
+        migrations.AddField(
+            model_name='tag',
+            name='tag',
+            field=models.CharField(default=1, max_length=250, verbose_name='Tags related to the vote'),
+            preserve_default=False,
+        ),
+    ]
diff --git a/djangoldp_polls/migrations/0007_auto_20200723_2133.py b/djangoldp_polls/migrations/0007_auto_20200723_2133.py
new file mode 100644
index 0000000..e7ff8ae
--- /dev/null
+++ b/djangoldp_polls/migrations/0007_auto_20200723_2133.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.29 on 2020-07-23 21:33
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('djangoldp_polls', '0006_auto_20200723_1139'),
+    ]
+
+    operations = [
+        migrations.RenameField(
+            model_name='tag',
+            old_name='tag',
+            new_name='name',
+        ),
+    ]
diff --git a/djangoldp_polls/models.py b/djangoldp_polls/models.py
index 12aef4b..3d969ae 100644
--- a/djangoldp_polls/models.py
+++ b/djangoldp_polls/models.py
@@ -5,6 +5,7 @@ from djangoldp.models import Model
 from django.contrib.auth import get_user_model
 from django.db.models import Sum
 
+from djangoldp_conversation.models import Conversation
 
 User = get_user_model()
 User.name=User.get_full_name
@@ -46,16 +47,17 @@ class Poll (Model):
     title = models.CharField(max_length=250,verbose_name="Title")
     image = models.URLField(blank=True, null=True, verbose_name="Illustration de l'évènement")
     hostingOrganisation = models.CharField(max_length=250,verbose_name="Name of the hosting organisation")
+    startDate = models.DateField(verbose_name="Date de début", blank=True, null=True ) 
     endDate =  models.DateField(verbose_name="Date de fin" )
     shortDescription = models.CharField(max_length=250,verbose_name="Short description")
     longDescription = models.TextField(verbose_name="Long description")
     tags = models.ManyToManyField(Tag, related_name='tags', blank=True)
     pollOptions = models.ManyToManyField(PollOption, related_name='relatedPollOptions', blank=True)
-    #debate = models.ManyToManyField(Debate, related_name='debate', blank=True)
+    #debate = models.ManyToManyField(Conversation, related_name='debate', blank=True)
     #relatedVotes = models.ManyToManyField(Vote, related_name='relatedVotes', blank=True)
 
     class Meta : 
-        serializer_fields = ['@id','created_at','pollOptions','votes','author','title','image','hostingOrganisation','endDate','shortDescription','longDescription','tags']
+        serializer_fields = ['@id','created_at','pollOptions','votes','author','title','image','hostingOrganisation','startDate','endDate','shortDescription','longDescription','tags']
         nested_fields = ['tags','votes','pollOptions']
         anonymous_perms = ['view','add','change']
         authenticated_perms = ['inherit','add']
@@ -75,4 +77,5 @@ class Vote (Model):
         serializer_fields = ['@id','chosenOption','relatedPoll']
         nested_fields = []
         anonymous_perms = ['view','add','change']
-        authenticated_perms =  ['inherit','add']
\ No newline at end of file
+        authenticated_perms =  ['inherit','add']
+    
\ No newline at end of file
-- 
GitLab