python - Django Many to Many Fields - OK with large datasets? -


i've done number of searches on here , read through manytomany documentation django , think model type fits needs. however, given way field appears on admin page, i'm worried i'll have data type work correctly purpose.

i have 2 models, image , post. want set models such image can associated number of posts , other way around. concern tens/hundreds of thousands of posts , images, admin page unmanageable , take long load.

here's have now:

class image(models.model):      post = models.manytomanyfield(post)      image = models.imagefield(upload_to=f, blank=true)    class post(models.model):      post_title = models.charfield(max_length=113)      text = models.charfield(max_length=1500)      pub_date = models.datetimefield('post date')      image = models.manytomanyfield(image)

is there better way handle this? thought creating separate database table foreign keys both image , post. every association between post , image have entry in table. work?

that generate 2 m2m columns. want 1 m2m column:

class image(models.model):     image = models.imagefield(upload_to=f, blank=true)  class post(models.model):     post_title = models.charfield(max_length=113)     text = models.charfield(max_length=1500)     pub_date = models.datetimefield('post date')     images = models.manytomanyfield(image) 

querying reverse relationship specified with:

image_instance.post_set.all() 

the other part of question db optimization question , determines kind of queries you're going running against it.

the transfer of blob data take longest time, , true if stored in db or filesystem.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -