django how to model this table correctly? -


following suggestions last post got far:

post model:

class post(models.model):     title = models.charfield(max_length=120)     content = models.textfield() 

group model:

class group(models.model):     title = models.charfield(max_length=200)     url = models.urlfield(unique=true)     contact_updated = models.datefield(auto_now=false, auto_now_add=true)     group_status = models.charfield(max_length=20)     admin = models.charfield(max_length=20)     admin_status = models.charfield(max_length=20)     frequency = models.integerfield()  # allowed post frequency     frq_scale = models.charfield(max_length=20, blank=true)     obs = models.textfield(blank=true)      posts = models.manytomanyfield(post, through='control.control') 

control model:

class control(models.model):     published = models.datefield(auto_now=false, auto_now_add=false)      post = models.foreignkey('posts.post', on_delete=models.cascade)     group = models.foreignkey('groups.group', on_delete=models.cascade) 

this control posts in groups. can have 1 post published in many groups controlled control model.

correction: possible post published in many groups.

how can produce table (link above) models? or perhaps there need change?

the table want produce

class control(models.model):     published = models.datefield(auto_now=false, auto_now_add=false)      post = models.foreignkey('posts.post', on_delete=models.cascade)     group = models.foreignkey('groups.group', on_delete=models.cascade)      class meta:         unique_together = (post, group ) 

Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -