From 419154caac40aef74740279b4041ef64292f49df Mon Sep 17 00:00:00 2001 From: Med Date: Fri, 30 Jun 2017 16:01:44 +0200 Subject: [PATCH] Auteur en many to many --- media/migrations/0005_auto_20170630_1551.py | 24 +++++++++++++++++++++ media/models.py | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 media/migrations/0005_auto_20170630_1551.py diff --git a/media/migrations/0005_auto_20170630_1551.py b/media/migrations/0005_auto_20170630_1551.py new file mode 100644 index 0000000..dea51fd --- /dev/null +++ b/media/migrations/0005_auto_20170630_1551.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.2 on 2017-06-30 13:51 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('media', '0004_auto_20170629_1539'), + ] + + operations = [ + migrations.RemoveField( + model_name='media', + name='auteur', + ), + migrations.AddField( + model_name='media', + name='auteur', + field=models.ManyToManyField(to='media.Auteur'), + ), + ] diff --git a/media/models.py b/media/models.py index ddc0ba3..e52ad29 100644 --- a/media/models.py +++ b/media/models.py @@ -9,7 +9,7 @@ class Auteur(models.Model): class Media(models.Model): titre = models.CharField(max_length=255) cote = models.CharField(max_length=31) - auteur = models.ForeignKey('Auteur', on_delete=models.PROTECT) + auteur = models.ManyToManyField('Auteur') # type = TODO def __str__(self):