Re: Django API efficient enough for filtering tens of millions of records?

2011-02-20 Thread Sithembewena Lloyd Dube
Thanks Thomas :) On Tue, Feb 15, 2011 at 11:16 AM, Thomas Weholt wrote: > FYI: release version 0.5.0 of DSE yesterday. Source is available at > https://bitbucket.org/weholt/dse and pypi. > > Regards, > Thomas Weholt > > On Tue, Feb 15, 2011 at 10:10 AM, Sithembewena

Re: Python's 20th Birthday (well, public release birthday) Extravaganza Lunch Party!

2011-02-20 Thread Gabriel Gunderson
On Fri, Feb 18, 2011 at 2:12 PM, Gabriel Gunderson wrote: > We'll be gathering Monday to have pizza, giant subs, spam with eggs**, > and a specially commissioned Python-themed cake by Joseph Hall of 3D > TuxCake fame[2]. Heh, I thought I'd share a cake update. We're going to

RE: urls.py and views.generic issue

2011-02-20 Thread Chris Matthews
It also seems that the space preceding the caret ^ should not be there So ^blog/ ^(?P\d{4})/$ Should be ^blog/^(?P\d{4})/$ -Original Message- From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of jnns Sent: 20 February 2011 03:07 To: Django users

Re: Redirecting to last view after login.

2011-02-20 Thread keynesiandreamer
Thanks so much for the reply Scott. Wish I would have seen it a bit sooner. So I double checked my TEMPLATE_CONTEXT_PROCESSORS as you suggested: TEMPLATE_CONTEXT_PROCESSORS = ( "django.core.context_processors.auth", "django.core.context_processors.debug",

Integrating Django with Amazon's Database

2011-02-20 Thread ravi krishna
Hi, Can somebody help me to integrate Django with Amazon's Database (SimpleDB). Can we use SimpleDB like sqlite or mysql with Django? What are the process involved in doing it ? It would be great help if someone could explain me or send me some tutorial for doing it. Thanks & Regards, Ravi

Re: What will happen when a model I modified get saved.

2011-02-20 Thread Shawn Milochik
On Sun, Feb 20, 2011 at 5:33 PM, wrote: > Hey Shawn, > I have been opportuned to have south installed on my pc but I must confess I > have never understood its use. Now that its being mentioned in here, I think > I am going to get into it and understand its use. > Sent

Re: objects added via inline not logged

2011-02-20 Thread Karen Tracey
On Sun, Feb 20, 2011 at 9:39 PM, Frank W. Samuelson < fr...@merrill-samuelson.com> wrote: > I have an class payment that links to households > class Payment(models.Model): ># Which household made this payment? >household = models.ForeignKey(Household) >... > > and the household has a

objects added via inline not logged

2011-02-20 Thread Frank W. Samuelson
I have an class payment that links to households class Payment(models.Model): # Which household made this payment? household = models.ForeignKey(Household) ... and the household has a payment inline in the admin interface. When I add a payment from the list of Payments, the first

Re: Filtering List based on a custom dropdown

2011-02-20 Thread Andre Terra
I'd also like some input on this, as I'm reaching a point of my project where I'll have to deal with a similar issue. I was planning on using ajax, which actually means keeping it simple IMHO, but I would really like to follow best practice. Should I make one query with a large subset of the data

Re: How to display value from a sub model in the template

2011-02-20 Thread Shawn Milochik
What are the related_name values you gave to the foreign key fields of your related models? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send

How to display value from a sub model in the template

2011-02-20 Thread Chris
Hi ! I have template page I'm trying to list all the player of a team, The player model have 2 sub-model: playerVital and playerSkill. The model playerVital has a one to one relation ship with the player model and player skill have a foreign key to the player model. How can I show the value of

Re: Select x random rows from DB

2011-02-20 Thread Christophe Pettus
On Feb 20, 2011, at 2:19 PM, galago wrote: > What is the best way, to select X random rows from DB? I know that method: > .all().order_by('?')[:X] is not good idea. The best way is to push it onto the DB, using a raw query: random_results = Table.objects.raw("SELECT * FROM table ORDER

Re: What will happen when a model I modified get saved.

2011-02-20 Thread delegbede
Hey Shawn, I have been opportuned to have south installed on my pc but I must confess I have never understood its use. Now that its being mentioned in here, I think I am going to get into it and understand its use. Sent from my BlackBerry wireless device from MTN -Original Message-

Re: Select x random rows from DB

2011-02-20 Thread Cal Leeming [Simplicity Media Ltd]
Also, take strong notice of this part: EXAMPLE:>>> _t = time.time(); x = map(lambda x: x, Post.objects.filter(id__gte=40, id__lt=400500).all()); print "Took %ss"%(time.time() - _t)Took 0.0467309951782s>>> _t = time.time(); _res = map(lambda x: x,

Re: Select x random rows from DB

2011-02-20 Thread Cal Leeming [Simplicity Media Ltd]
Also, this snippet isn't directly related, but it does show the methods we used to paginate through 50 million rows, with query times of below 0.5 seconds :) It uses the same method that was in my first suggestion (the ID max thing) http://djangosnippets.org/snippets/2277/ Cal On Sun, Feb 20,

Re: Select x random rows from DB

2011-02-20 Thread delegbede
That would have been my approach if I were to do that. So, we are now two seeking the good way to get it done. Hello People, Galago and I have the same challenge, please help us. Sent from my BlackBerry wireless device from MTN -Original Message- From: galago

Re: Select x random rows from DB

2011-02-20 Thread Cal Leeming [Simplicity Media Ltd]
Hi Galago, There are several ways to do this, and it really depends on the size of your database, and what your storage policies are. Here are some of the various methods we have used: - Use ID max, then random.randint(). Only works if you *never* delete rows from the database, and

Re: Select x random rows from DB

2011-02-20 Thread delegbede
Knowing what is not a good idea means you know what the good idea is, logically. So, Galago, what's the good idea??? Sent from my BlackBerry wireless device from MTN -Original Message- From: galago Sender: django-users@googlegroups.com Date: Sun, 20 Feb 2011 14:19:14

Re: Select x random rows from DB

2011-02-20 Thread galago
If i knew what is a good idea, I wouldn't aks here:D I only know - that described method is DB killer :) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from

Select x random rows from DB

2011-02-20 Thread galago
What is the best way, to select X random rows from DB? I know that method: .all().order_by('?')[:X] is not good idea. What methods do you use? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

post_init signal or overriding __init__ which is the way to go

2011-02-20 Thread Christan
By another post I simultaneously posted with this one, Now, I confirmed myself that instance of Foo that gets associated with model instance will not be saved in db, because it's not a subclass of one of the fields that model provides. *Now, only thing remaining is, whether I use post_init

Re: What will happen when a model I modified get saved.

2011-02-20 Thread Christan
1) That was a typo, forget it. 2) This answers my question, Thanks :) 3) I know this, but haven't tried South yet. BTW., Thank you for your time > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: What will happen when a model I modified get saved.

2011-02-20 Thread Shawn Milochik
First, what are you trying to do? 1. The code you posted is not valid Python, because 'Object' is capitalized. So you haven't actually even tried this, or it would have blown up. 2. Adding 'y' to your subclass of Model does nothing with the database, because y is not a subclass of one of the

What will happen when a model I modified get saved.

2011-02-20 Thread Christan
See the model below, class Foo(models.Model): x = model.IntegerField() Also, a class as follows class Bar(Object): y = 1212121L - Now, If I modified above Foo like this class Foo(models.Model):

Populating extra fields on models at init that doesn't have to be saved in table and originally isn't part of the model.

2011-02-20 Thread Christan
I've this model class DistributionList(CommonList): distributionListID = models.IntegerField() NB: CommonList is another model with abstract=True in Meta class. (Abstract Base Class) Now, On the initialization of this DistributionList(whether newly created or retrieved from db), I've to

Re: stop caching json response

2011-02-20 Thread Eric Hutchinson
check out: http://docs.djangoproject.com/en/1.2/topics/cache/#controlling-cache-using-other-headers On Feb 20, 7:06 am, Олег Корсак wrote: > Hello. I have memcached mw enabled. And I can see that response is > cached in memcached. I want to stop caching that.

Re: How to pivot a table?

2011-02-20 Thread idahogray
I am not sure what database you are using, but I just did this using a raw query and postgresql's crosstab function. http://www.postgresql.org/docs/current/static/tablefunc.html http://docs.djangoproject.com/en/1.2/topics/db/sql/#executing-custom-sql-directly On Feb 18, 7:25 am, Derek

Re: stop caching json response

2011-02-20 Thread Shawn Milochik
A quick and dirty way is to append a timestamp to the URL so it's always unique. That way it won't be cached. Add "new Date().getTime()" to the end of the URL your AJAX call requests. Just have your url pattern accept and ignore the extra stuff. Shawn -- You received this message because you

Re: Not able to use ModelForm

2011-02-20 Thread The_Legend
Daniel thanks man for helping, and noticing problems in that dirty mess. i am basically very new to django. I hadn't given a field called address in the form, and + didnt give it blank=True in the model either so i guess it wasnt working, + what you said was also true. thanks a lot, hope u are

Application Name in Django urls.

2011-02-20 Thread Uolter
I am running Pootle http://translate.sourceforge.net/wiki/pootle/index which is basically a Django apps on dabian server. All the urls look like: http:///account/login?next=index http:///docs/index.html http:///admin/ and so on. I would like to add the application name before each path:

Customize inlines in django admin

2011-02-20 Thread Gianluca Pacchiella
Hi folks, I have a problem with an admin inline form for a model having a ManyToMany field: the default is to visualize a select having as options all the instances available for that kind of model, with a plus button to create a new one on the fly. My problem is I want only to add the object

Re: Not able to use ModelForm

2011-02-20 Thread Daniel Roseman
On Sunday, February 20, 2011 12:05:12 PM UTC, The_Legend wrote: > > Oh sorry, i thought i wrote, but i guess it didnt convey the message. > > have written a registration form. so it takes data from this form then > first creates a user then i have a model called people in my app > called

stop caching json response

2011-02-20 Thread Олег Корсак
Hello. I have memcached mw enabled. And I can see that response is cached in memcached. I want to stop caching that. How is it possible to do? Thanks def do_something(request): return HttpResponse('yoyoyo23', content_type = 'application/javascript; charset=utf8') signature.asc

Re: Not able to use ModelForm

2011-02-20 Thread The_Legend
Oh sorry, i thought i wrote, but i guess it didnt convey the message. have written a registration form. so it takes data from this form then first creates a user then i have a model called people in my app called mainapp. so i just need to add data to the database for this model. but i am not

Re: Not able to use ModelForm

2011-02-20 Thread Daniel Roseman
On Sunday, February 20, 2011 11:26:18 AM UTC, The_Legend wrote: > > i am not able to use model forms to input data for models in database. > > I'd get some treatment for that, if I were you. Seriously, what problem are you having? Are we supposed to guess? -- DR. -- You received this message

Not able to use ModelForm

2011-02-20 Thread The_Legend
i am not able to use model forms to input data for models in database. model.py -- gender_list = (('M', 'Male'), ('F', 'Female' )) class people(models.Model): userID = models.ForeignKey(User, unique=True) name = models.CharField('name',max_length=30) address =

Re: testing foo_set existence for each object in a queryset

2011-02-20 Thread Dan
Hi Lior, Thanks for the effort - but I'm not sure it can be done this way. The problem is the related model is not accessible at the level of MyModel - only at the level of its instances (if I'm saying that correctly). So if I try something like that I get the error message: "Cannot resolve

Re: testing foo_set existence for each object in a queryset

2011-02-20 Thread Dan
Thanks Shawn That's helpful. I was actually looking at the manager documentation today thinking perhaps that was what I needed - but couldn't quite wrap my head around it. But knowing that it indeed is the way to go will no doubt provide the motivation I need. (I have problems learning

How to assign form names in formset before rendering??

2011-02-20 Thread balu
Hi all... I'm working on building an oline examination system. Here is a view which picks some questions randomly from the database and generates 10 questions. I could able to display these questions on the web page. In that web page there should be a formset which have options A, B, C, D. The