Suppression du modèle school
This commit is contained in:
parent
16bd2a7d66
commit
86e2fbaf77
4 changed files with 4 additions and 61 deletions
|
@ -1,20 +0,0 @@
|
||||||
# Generated by Django 2.0.1 on 2018-01-20 23:50
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('content', '0001_initial'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='Ecole',
|
|
||||||
fields=[
|
|
||||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
||||||
('name', models.CharField(max_length=255)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,17 +0,0 @@
|
||||||
# Generated by Django 2.0.1 on 2018-01-20 23:52
|
|
||||||
|
|
||||||
from django.db import migrations
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('content', '0002_ecole'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.RenameModel(
|
|
||||||
old_name='Ecole',
|
|
||||||
new_name='School',
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -10,16 +10,6 @@ class Category(models.Model):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class School(models.Model):
|
|
||||||
"""Une école."""
|
|
||||||
name = models.CharField(
|
|
||||||
max_length=255
|
|
||||||
)
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return self.name
|
|
||||||
|
|
||||||
|
|
||||||
class Content(models.Model):
|
class Content(models.Model):
|
||||||
"""Un contenu du site (vidéo)."""
|
"""Un contenu du site (vidéo)."""
|
||||||
name = models.CharField(
|
name = models.CharField(
|
||||||
|
|
|
@ -1,22 +1,12 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.core import validators
|
from django.core import validators
|
||||||
from content.models import School, Category, Video
|
from content.models import Content
|
||||||
|
from django.contrib.auth.models import Group, User
|
||||||
class Voter(models.Model):
|
|
||||||
name = models.CharField(max_length=100)
|
|
||||||
firstname = models.CharField(max_length=100)
|
|
||||||
email = models.EmailField(max_length=200)
|
|
||||||
ecole = models.ForeignKey('content.School', on_delete=models.CASCADE)
|
|
||||||
password = models.CharField(max_length=100)
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return self.firstname + " " + self.name
|
|
||||||
|
|
||||||
|
|
||||||
class Vote(models.Model):
|
class Vote(models.Model):
|
||||||
votant = models.ForeignKey('Voter', on_delete=models.CASCADE)
|
votant = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||||
video = models.ForeignKey('content.Video', on_delete=models.CASCADE)
|
content = models.ForeignKey(Content, on_delete=models.CASCADE)
|
||||||
categorie = models.ForeignKey('content.Category', on_delete=models.CASCADE)
|
|
||||||
vote = models.IntegerField(
|
vote = models.IntegerField(
|
||||||
validators=[
|
validators=[
|
||||||
validators.MaxValueValidator(5),
|
validators.MaxValueValidator(5),
|
||||||
|
|
Loading…
Reference in a new issue