On Mon, Oct 28, 2013 at 8:23 PM, Ruturaj Dhekane wrote:
> Thanks Daniel and Robin.
>
> Have we seen the scales where Many-to-many DBs through Django work well?
> Like 50K articles in 5K publications.
Numbers are really meaningless. One of our legacy products has a
database with 300 million rows i
Thanks Daniel and Robin.
Have we seen the scales where Many-to-many DBs through Django work well?
Like 50K articles in 5K publications.
The aim of this question was to make a design choice too - whether I should
use Django constructs/calls directly or should i write my own SQL to make
queries - as
First of all , any DBMS that is misused by design or in operation will give
poor performance.. There is an excellent mature database available for
Django developers, PostgreSQL. It works fine on the same machine as you are
developing on.
MongoDB is NOT a suitable DB for general purposes. It is
On Sunday, 27 October 2013 00:46:17 UTC+1, Ruturaj Dhekane wrote:
> Hi all,
>
> I have a particular datastructure where there are two objects
> 1. A document - and a lot of its properties - like content, version,
> timestamp etc.
> 2. Contributors - basically people represented by unique IDs
>
>
Hi all,
I have a particular datastructure where there are two objects
1. A document - and a lot of its properties - like content, version,
timestamp etc.
2. Contributors - basically people represented by unique IDs
A document can have many contributors and a contributor can author many
documents.
On Sun, Jan 31, 2010 at 1:38 AM, chefsmart wrote:
> Let's say I have two models - Article and Publication. Article has a
> field
>
> publications = models.ManyToManyField(Publication)
>
> Let's say I present the user with a series of checkboxes representing
> publications (much like the ModelMult
Let's say I have two models - Article and Publication. Article has a
field
publications = models.ManyToManyField(Publication)
Let's say I present the user with a series of checkboxes representing
publications (much like the ModelMultipleChoiceField, but I am not
using ModelForms here) and gettin
What you could do is create the intermediary table explicitly using
the through keyword:
http://docs.djangoproject.com/en/dev//topics/db/models/#extra-fields-on-many-to-many-relationships
then you can do queries on the table.
Alex
On Oct 1, 7:17 pm, "Dan W." <[EMAIL PROTECTED]> wrote:
> This is
This is my first time building an app with django and so far I've been
more than happy with it. However, I can't seem to figure out how to
sufficiently optimize queries for ManyToMany relationships. Here is a
model to illustrate my problem:
class Book(models.Model):
name = models.CharField(m
sorry, you need
story = Story.objects.filter(pk=1).extra(select={'main_section':
sub_select }).values('main_section', 'other_field1', 'other_field2' )
[0]
because we get here list of dictionaries
Good luck!
--~--~-~--~~~---~--~~
You received this message because
You can use an extra select to get additional parameter 'main_section'
This is for MySQL and it's only sample
you need to test it in your DB to make sure, that it works
sub_select = """SELECT section_name
FROM %(table_section)s as sc, %
(table_section_story)s as st
I modified the 'get_main_section' method in this way..
def get_main_section(self):
try:
sections = list(self.id_section.all().order_by('order'))
if (len(sections) > 1):
section_name = sections[1]
else:
section_name =
I still think you need second query.
as i understand from your code get_main_section will return list of
Sections in Story?
I mean this string:
(section_name = self.id_section.all().order_by('order') )
bad:
if (len(self.id_section.all()) > 1):#hits DB
section_name = self.id_section.
I was not enough precise..
'Story' object has a method get_main_section...
def get_main_section(self):
try:
if (len(self.id_section.all()) > 1):
section_name = self.id_section.all().order_by('order')
[1]
else:
section_name = self.i
it seems you need extra select anyway
or use .extra(...) to add additional args to db query
(http://www.djangoproject.com/documentation/db-api/#extra-select-none-
where-none-params-none-tables-none-order-by-none-select-params-none)
But i don't understand. Imagine we have Story with 3 Sections
And
Solution #1:
use select_related() method when you get your Story from db:
Story.objects.get(pk=3).select_related()
Solution #2:
add to your Section class definition method:
def __unicode__(self):
return self.section_name
and change your template to:
{{ story.id_
I tried with select_related, but it read only foreignKey and not
ManyToMany relations..
The section object already has __unicode__ method..
def __unicode__(self):
return u'%s - %s' % (self.id_site.domain, self.section_name)
Thanks
Davide
On 3 Set, 15:40, krylatij <[EMAIL PROTECTED]
Hi All..
I've a performance problem with manyToMany relations..
I've a model like this:
class Story(models.Model):
title = models.TextField(verbose_name =
"titolo" ,max_length=200,core=True)
abstract = models.TextField('sommario',max_length=400,core=True)
text = models.TextField(v
18 matches
Mail list logo