mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-18 04:03:22 +00:00
Normally fixs tests
This commit is contained in:
parent
d14af8e452
commit
a284637190
@ -124,14 +124,6 @@ Welcome to the wiki page!
|
|||||||
skia.save()
|
skia.save()
|
||||||
skia.view_groups=[Group.objects.filter(name=settings.SITH_MAIN_MEMBERS_GROUP).first().id]
|
skia.view_groups=[Group.objects.filter(name=settings.SITH_MAIN_MEMBERS_GROUP).first().id]
|
||||||
skia.save()
|
skia.save()
|
||||||
# Adding user sli
|
|
||||||
sli = User(username='sli', last_name="Li", first_name="S",
|
|
||||||
email="sli@git.an",
|
|
||||||
date_of_birth="1942-06-12")
|
|
||||||
sli.set_password("plop")
|
|
||||||
sli.save()
|
|
||||||
skia.view_groups=[Group.objects.filter(name=settings.SITH_MAIN_MEMBERS_GROUP).first().id]
|
|
||||||
sli.save()
|
|
||||||
# Adding user public
|
# Adding user public
|
||||||
public = User(username='public', last_name="Not subscribed", first_name="Public",
|
public = User(username='public', last_name="Not subscribed", first_name="Public",
|
||||||
email="public@git.an",
|
email="public@git.an",
|
||||||
@ -229,14 +221,6 @@ Cette page vise à documenter la syntaxe *Markdown* utilisée sur le site.
|
|||||||
duration=settings.SITH_SUBSCRIPTIONS[s.subscription_type]['duration'],
|
duration=settings.SITH_SUBSCRIPTIONS[s.subscription_type]['duration'],
|
||||||
start=s.subscription_start)
|
start=s.subscription_start)
|
||||||
s.save()
|
s.save()
|
||||||
## Sli
|
|
||||||
s = Subscription(member=Subscriber.objects.filter(pk=sli.pk).first(), subscription_type=list(settings.SITH_SUBSCRIPTIONS.keys())[0],
|
|
||||||
payment_method=settings.SITH_SUBSCRIPTION_PAYMENT_METHOD[0])
|
|
||||||
s.subscription_start = s.compute_start()
|
|
||||||
s.subscription_end = s.compute_end(
|
|
||||||
duration=settings.SITH_SUBSCRIPTIONS[s.subscription_type]['duration'],
|
|
||||||
start=s.subscription_start)
|
|
||||||
s.save()
|
|
||||||
## Comptable
|
## Comptable
|
||||||
s = Subscription(member=User.objects.filter(pk=comptable.pk).first(), subscription_type=list(settings.SITH_SUBSCRIPTIONS.keys())[0],
|
s = Subscription(member=User.objects.filter(pk=comptable.pk).first(), subscription_type=list(settings.SITH_SUBSCRIPTIONS.keys())[0],
|
||||||
payment_method=settings.SITH_SUBSCRIPTION_PAYMENT_METHOD[0])
|
payment_method=settings.SITH_SUBSCRIPTION_PAYMENT_METHOD[0])
|
||||||
@ -327,6 +311,22 @@ Cette page vise à documenter la syntaxe *Markdown* utilisée sur le site.
|
|||||||
simple.save()
|
simple.save()
|
||||||
woenzco = Company(name="Woenzel & co")
|
woenzco = Company(name="Woenzel & co")
|
||||||
woenzco.save()
|
woenzco.save()
|
||||||
|
# Adding user sli
|
||||||
|
sli = User(username='sli', last_name="Li", first_name="S",
|
||||||
|
email="sli@git.an",
|
||||||
|
date_of_birth="1942-06-12")
|
||||||
|
sli.set_password("plop")
|
||||||
|
sli.save()
|
||||||
|
skia.view_groups=[Group.objects.filter(name=settings.SITH_MAIN_MEMBERS_GROUP).first().id]
|
||||||
|
sli.save()
|
||||||
|
## Adding subscription for sli
|
||||||
|
s = Subscription(member=User.objects.filter(pk=sli.pk).first(), subscription_type=list(settings.SITH_SUBSCRIPTIONS.keys())[0],
|
||||||
|
payment_method=settings.SITH_SUBSCRIPTION_PAYMENT_METHOD[0])
|
||||||
|
s.subscription_start = s.compute_start()
|
||||||
|
s.subscription_end = s.compute_end(
|
||||||
|
duration=settings.SITH_SUBSCRIPTIONS[s.subscription_type]['duration'],
|
||||||
|
start=s.subscription_start)
|
||||||
|
s.save()
|
||||||
|
|
||||||
operation_list = [
|
operation_list = [
|
||||||
(27, "J'avais trop de bière", 'CASH', None, buying, 'USER', skia.id, "", None),
|
(27, "J'avais trop de bière", 'CASH', None, buying, 'USER', skia.id, "", None),
|
||||||
@ -349,10 +349,10 @@ Cette page vise à documenter la syntaxe *Markdown* utilisée sur le site.
|
|||||||
operation.save()
|
operation.save()
|
||||||
|
|
||||||
# Create an election
|
# Create an election
|
||||||
el = Election(title="Élection 2017", description="La roue tourne", start_proposal='1942-06-12 10:28:45', end_proposal='2042-06-12 10:28:45',start_date='1942-06-12 10:28:45', end_date='7942-06-12 10:28:45')
|
# el = Election(title="Élection 2017", description="La roue tourne", start_proposal='1942-06-12 10:28:45', end_proposal='2042-06-12 10:28:45',start_date='1942-06-12 10:28:45', end_date='7942-06-12 10:28:45')
|
||||||
el.save()
|
# el.save()
|
||||||
resp = Responsability(election=el, title="Co Respo Info", description="Ghetto++")
|
# resp = Responsability(election=el, title="Co Respo Info", description="Ghetto++")
|
||||||
resp.save()
|
# resp.save()
|
||||||
cand = Candidate(responsability=resp, user=skia)
|
# cand = Candidate(responsability=resp, user=skia)
|
||||||
cand.save()
|
# cand.save()
|
||||||
|
|
||||||
|
@ -13,10 +13,11 @@ class Migration(migrations.Migration):
|
|||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Candidate',
|
name='Candidature',
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(serialize=False, primary_key=True, auto_created=True, verbose_name='ID')),
|
('id', models.AutoField(serialize=False, primary_key=True, auto_created=True, verbose_name='ID')),
|
||||||
('program', models.TextField(blank=True, null=True, verbose_name='description')),
|
('program', models.TextField(blank=True, null=True, verbose_name='description')),
|
||||||
|
('has_voted', models.ManyToManyField(related_name='has_voted', to=settings.AUTH_USER_MODEL, verbose_name='has_voted')),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
@ -25,38 +26,44 @@ class Migration(migrations.Migration):
|
|||||||
('id', models.AutoField(serialize=False, primary_key=True, auto_created=True, verbose_name='ID')),
|
('id', models.AutoField(serialize=False, primary_key=True, auto_created=True, verbose_name='ID')),
|
||||||
('title', models.CharField(max_length=255, verbose_name='title')),
|
('title', models.CharField(max_length=255, verbose_name='title')),
|
||||||
('description', models.TextField(blank=True, null=True, verbose_name='description')),
|
('description', models.TextField(blank=True, null=True, verbose_name='description')),
|
||||||
('start_proposal', models.DateTimeField(verbose_name='start proposal')),
|
('start_candidature', models.DateTimeField(verbose_name='start candidature')),
|
||||||
('end_proposal', models.DateTimeField(verbose_name='end proposal')),
|
('end_candidature', models.DateTimeField(verbose_name='end candidature')),
|
||||||
('start_date', models.DateTimeField(verbose_name='start date')),
|
('start_date', models.DateTimeField(verbose_name='start date')),
|
||||||
('end_date', models.DateTimeField(verbose_name='end date')),
|
('end_date', models.DateTimeField(verbose_name='end date')),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Responsability',
|
name='List',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(serialize=False, primary_key=True, auto_created=True, verbose_name='ID')),
|
||||||
|
('title', models.CharField(max_length=255, verbose_name='title')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Role',
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(serialize=False, primary_key=True, auto_created=True, verbose_name='ID')),
|
('id', models.AutoField(serialize=False, primary_key=True, auto_created=True, verbose_name='ID')),
|
||||||
('title', models.CharField(max_length=255, verbose_name='title')),
|
('title', models.CharField(max_length=255, verbose_name='title')),
|
||||||
('description', models.TextField(blank=True, null=True, verbose_name='description')),
|
('description', models.TextField(blank=True, null=True, verbose_name='description')),
|
||||||
('election', models.ForeignKey(to='election.Election', verbose_name='election', related_name='responsability')),
|
('election', models.ForeignKey(related_name='role', to='election.Election', verbose_name='election')),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Vote',
|
name='Vote',
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(serialize=False, primary_key=True, auto_created=True, verbose_name='ID')),
|
('id', models.AutoField(serialize=False, primary_key=True, auto_created=True, verbose_name='ID')),
|
||||||
('candidate', models.ManyToManyField(to='election.Candidate', related_name='vote', verbose_name='candidate')),
|
('candidature', models.ManyToManyField(related_name='vote', to='election.Candidature', verbose_name='candidature')),
|
||||||
('election', models.ForeignKey(to='election.Election', verbose_name='election', related_name='vote')),
|
('role', models.ForeignKey(related_name='vote', to='election.Role', verbose_name='role')),
|
||||||
('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, verbose_name='user', related_name='vote')),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='candidate',
|
model_name='candidature',
|
||||||
name='responsability',
|
name='role',
|
||||||
field=models.ForeignKey(to='election.Responsability', verbose_name='responsability', related_name='candidate'),
|
field=models.ForeignKey(related_name='candidature', to='election.Role', verbose_name='role'),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='candidate',
|
model_name='candidature',
|
||||||
name='user',
|
name='user',
|
||||||
field=models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, verbose_name='user', related_name='candidate'),
|
field=models.ForeignKey(blank=True, related_name='candidate', to=settings.AUTH_USER_MODEL, verbose_name='user'),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
@ -5,8 +5,6 @@ from django.conf import settings
|
|||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from core.models import User
|
from core.models import User
|
||||||
from subscription.models import Subscriber
|
|
||||||
from subscription.views import get_subscriber
|
|
||||||
|
|
||||||
|
|
||||||
class Election(models.Model):
|
class Election(models.Model):
|
||||||
@ -66,7 +64,7 @@ class List(models.Model):
|
|||||||
"""
|
"""
|
||||||
To allow per list vote
|
To allow per list vote
|
||||||
"""
|
"""
|
||||||
title = models.CharField(_('title'))
|
title = models.CharField(_('title'), max_length=255)
|
||||||
|
|
||||||
|
|
||||||
class Vote(models.Model):
|
class Vote(models.Model):
|
||||||
|
@ -6,7 +6,7 @@ from django.utils.translation import ugettext_lazy as _
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
from core.views import CanViewMixin, CanEditMixin, CanEditPropMixin, CanCreateMixin
|
from core.views import CanViewMixin, CanEditMixin, CanEditPropMixin, CanCreateMixin
|
||||||
from election.models import Election, Responsability, Candidate
|
from election.models import Election, Role, Candidature
|
||||||
|
|
||||||
# Display elections
|
# Display elections
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user