Skip to content
Extraits de code Groupes Projets
Valider 42eb80b1 rédigé par luxcem's avatar luxcem Validation de Arnaud Fabre
Parcourir les fichiers

new vote model

parent 1c99e625
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
*.sqlite3
*.sqlite
*.pyc
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Dossier',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('title', models.CharField(max_length=500)),
('reference', models.CharField(max_length=200)),
('text', models.TextField()),
('link', models.URLField()),
],
options={
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Proposal',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('title', models.CharField(max_length=500)),
('description', models.TextField()),
('reference', models.CharField(max_length=200)),
('datetime', models.DateTimeField()),
('dossier', models.ForeignKey(to='representatives_votes.Dossier')),
],
options={
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Vote',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('representative_slug', models.CharField(max_length=200, null=True, blank=True)),
('representative_remote_id', models.CharField(max_length=200, null=True, blank=True)),
('position', models.CharField(max_length=10, choices=[(b'abstain', b'abstain'), (b'for', b'for'), (b'against', b'against')])),
('proposal', models.ForeignKey(to='representatives_votes.Proposal')),
],
options={
},
bases=(models.Model,),
),
]
# -*- coding:Utf-8 -*-
# coding: utf-8
from django.db import models
from parltrack_meps.models import MEP
class Proposal(models.Model):
title = models.TextField(null=True)
code_name = models.CharField(max_length=255, unique=True)
date = models.DateField(default=None, null=True, blank=True)
class Dossier(models.Model):
title = models.CharField(max_length=500)
reference = models.CharField(max_length=200)
text = models.TextField()
link = models.URLField()
def __unicode__(self):
return "%s [%s]" % (self.title if self.title else "no title", self.code_name)
class Meta:
ordering = ('-_date', )
class Proposal(models.Model):
dossier = models.ForeignKey(Dossier)
title = models.CharField(max_length=500)
description = models.TextField()
class ProposalPart(models.Model):
reference = models.CharField(max_length=200)
datetime = models.DateTimeField()
subject = models.CharField(max_length=255)
part = models.CharField(max_length=255)
description = models.CharField(max_length=511)
proposal = models.ForeignKey(Proposal)
def __unicode__(self):
return self.subject
class MetaClass:
ordering = ['datetime']
class Vote(models.Model):
choice = models.CharField(max_length=15, choices=((u'for', u'for'), (u'against', u'against'), (u'abstention', u'abstention'), (u'absent', u'absent')))
name = models.CharField(max_length=127)
proposal_part = models.ForeignKey(ProposalPart)
mep = models.ForeignKey(MEP, null=True)
VOTECHOICES = (
('abstain', 'abstain'),
('for', 'for'),
('against', 'against')
)
proposal = models.ForeignKey(Proposal)
class Meta:
ordering = ["choice"]
unique_together = ("proposal_part", "mep")
representative_slug = models.CharField(max_length=200, blank=True, null=True)
representative_remote_id = models.CharField(max_length=200, blank=True, null=True)
def __unicode__(self):
return '%s (%s)' % (self.name, self.choice)
position = models.CharField(max_length=10, choices=VOTECHOICES)
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter