I tried for hours to get django's migrate/makemigrations function work but 
miserably couldn't so I created my tables in MySQL. Now I'm trying to add a 
ManyToManyField between 2 models but am not sure how the MySQL syntax is 
supposed to look like.

This is my current code:

from django.db import models

class Publication(models.Model):
    title = models.CharField(max_length=30)

class Article(models.Model):
    headline = models.CharField(max_length=100)

and I can create a table as follows in MySQL:

CREATE TABLE publication ( 
    title varchar(30)
);
CREATE TABLE Article (
    headline varchar(100),
);

I need to add the ManyToManyField like so: 
class Article(models.Model):
    headline = models.CharField(max_length=100)
    *publications = models.ManyToManyField(Publication)*

I'm really running low on time, could someone assist me with what the MySQL 
code is supposed to look like? I will be permanently in your debt.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6f546243-23f0-4760-806b-9fff01d2afd7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to