Skip to content
Snippets Groups Projects
Commit 19a25baf authored by Maxime's avatar Maxime
Browse files

clean migration files && add dependencies in readme

parent ca7877eb
No related branches found
Tags v1.0.6
1 merge request!1Feature : sib polls
# Django LDP example
# Dependencies
This component must be used with another one. By default solid polls is used with solid-circles.
To use it by default run pip3 install djangoldp_circles.
To change the component it is combined with edit lines xxx and xxx of the models.py file
## Step by step quickstart
1. Installation
......
# -*- coding: utf-8 -*-
# Generated by Django 1.11.26 on 2020-05-25 00:56
# Generated by Django 1.11.29 on 2020-08-06 02:35
from __future__ import unicode_literals
from django.conf import settings
......@@ -13,6 +13,7 @@ class Migration(migrations.Migration):
initial = True
dependencies = [
('djangoldp_conversation', '0006_auto_20200617_1309'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
......@@ -22,14 +23,18 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('urlid', djangoldp.fields.LDPUrlField(blank=True, null=True, unique=True)),
('is_backlink', models.BooleanField(default=False, help_text='(DEPRECIATED) set automatically to indicate the Model is a backlink')),
('allow_create_backlink', models.BooleanField(default=True, help_text='set to False to disable backlink creation after Model save')),
('created_at', models.DateTimeField(auto_now_add=True)),
('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(blank=True, null=True, verbose_name='Date de début')),
('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')),
('author', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='createdVotes', to=settings.AUTH_USER_MODEL)),
('debate', models.ManyToManyField(blank=True, related_name='debates', to='djangoldp_conversation.Conversation')),
],
),
migrations.CreateModel(
......@@ -37,6 +42,8 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('urlid', djangoldp.fields.LDPUrlField(blank=True, null=True, unique=True)),
('is_backlink', models.BooleanField(default=False, help_text='(DEPRECIATED) set automatically to indicate the Model is a backlink')),
('allow_create_backlink', models.BooleanField(default=True, help_text='set to False to disable backlink creation after Model save')),
('name', models.CharField(max_length=250, verbose_name='Options available for a vote')),
],
),
......@@ -45,7 +52,9 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('urlid', djangoldp.fields.LDPUrlField(blank=True, null=True, unique=True)),
('name', models.CharField(max_length=250, verbose_name='Tags related to the vote')),
('is_backlink', models.BooleanField(default=False, help_text='(DEPRECIATED) set automatically to indicate the Model is a backlink')),
('allow_create_backlink', models.BooleanField(default=True, help_text='set to False to disable backlink creation after Model save')),
('name', models.CharField(max_length=250, verbose_name='Name')),
],
),
migrations.CreateModel(
......@@ -53,6 +62,8 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('urlid', djangoldp.fields.LDPUrlField(blank=True, null=True, unique=True)),
('is_backlink', models.BooleanField(default=False, help_text='(DEPRECIATED) set automatically to indicate the Model is a backlink')),
('allow_create_backlink', models.BooleanField(default=True, help_text='set to False to disable backlink creation after Model save')),
('chosenOption', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='userVote', to='djangoldp_polls.PollOption')),
('relatedPoll', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='votes', to='djangoldp_polls.Poll')),
('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='user', to=settings.AUTH_USER_MODEL)),
......
# -*- 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'),
),
]
# -*- 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'),
),
]
# -*- 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',
),
]
# -*- 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'),
),
]
# -*- 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,
),
]
# -*- 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',
),
]
......@@ -17,65 +17,65 @@ User.name=User.get_full_name
#========================
class Tag (Model):
name = models.CharField(max_length=250,verbose_name="Tags related to the vote")
name = models.CharField(max_length=250,verbose_name="Name")
class Meta :
serializer_fields = ['@id','name']
anonymous_perms = ['view']
authenticated_perms = ['inherit','add']
class Meta :
serializer_fields = ['@id','name']
anonymous_perms = ['view']
authenticated_perms = ['inherit','add']
def __str__(self):
return self.name
def __str__(self):
return self.name
class PollOption (Model):
name = models.CharField(max_length=250,verbose_name="Options available for a vote")
name = models.CharField(max_length=250,verbose_name="Options available for a vote")
class Meta :
serializer_fields = ['@id','name']
nested_fields = ['userVote','relatedPollOptions']
anonymous_perms = ['view','add']
authenticated_perms = ['inherit','add']
class Meta :
serializer_fields = ['@id','name']
nested_fields = ['userVote','relatedPollOptions']
anonymous_perms = ['view','add']
authenticated_perms = ['inherit','add']
def __str__(self):
return self.name
def __str__(self):
return self.name
class Poll (Model):
created_at = models.DateTimeField(auto_now_add=True)
author = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='createdVotes', null=True,blank=True)
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(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','startDate','endDate','shortDescription','longDescription','tags']
nested_fields = ['tags','votes','pollOptions']
anonymous_perms = ['view','add','change']
authenticated_perms = ['inherit','add']
def __str__(self):
return self.title
created_at = models.DateTimeField(auto_now_add=True)
author = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='createdVotes', null=True,blank=True)
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(Conversation, related_name='debates', blank=True)
#relatedVotes = models.ManyToManyField(Vote, related_name='relatedVotes', blank=True)
class Meta :
serializer_fields = ['@id','created_at','debate','pollOptions','votes','author','title','image','hostingOrganisation','startDate','endDate','shortDescription','longDescription','tags']
nested_fields = ['tags','votes','pollOptions','debate']
anonymous_perms = ['view','add','change']
authenticated_perms = ['inherit','add']
def __str__(self):
return self.title
class Vote (Model):
user = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='user',null=True,blank=True)
chosenOption = models.ForeignKey(PollOption, related_name='userVote')
relatedPoll = models.ForeignKey(Poll, related_name='votes')
class Meta :
auto_author = "user"
serializer_fields = ['@id','chosenOption','relatedPoll']
nested_fields = []
anonymous_perms = ['view','add','change']
authenticated_perms = ['inherit','add']
\ No newline at end of file
user = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='user',null=True,blank=True)
chosenOption = models.ForeignKey(PollOption, related_name='userVote')
relatedPoll = models.ForeignKey(Poll, related_name='votes')
class Meta :
auto_author = "user"
serializer_fields = ['@id','chosenOption','relatedPoll']
nested_fields = []
anonymous_perms = ['view','add','change']
authenticated_perms = ['inherit','add']
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment