Django Optimization: Database Access

2011-07-03 Thread Anand Agarwal
Hi All Recently we migrated from Django 1.1 to django 1.2 for our product BootStrapToday . We had to do some changes to optimize database queries on django 1.2. Here are some of our learnings, which might be useful to the group. http://bit.ly/lfoab0 Regards Anand http:/

Re: JQuery .load() works in production but fails in development

2011-07-03 Thread Andre Terra
I'm sorry none of us replied sooner; I for one completely missed the original message. For the record, you can use request.is_ajax to figure out whether a request is coming from a js file and make the view behave accordingly. It's mighty useful in some cases. Also, have you gone trough the offici

Django {% regroup %} produces duplicate groups

2011-07-03 Thread Federico Maggi
Hi, I've defined the following models: class Topic(models.Model): class Meta: ordering = [ 'title'] objects = models.Manager() highlighted = HighlightedTopicManager() highlight = models.BooleanField( default=False, help_text='Show this topic on the home page?', db_index=

Re: Dynamic Form Fields in Django using JavaScript

2011-07-03 Thread AJ
Nevermind. I did not know about and eventually solved it with formsets. Thanks. On Sun, Jul 3, 2011 at 4:34 PM, AJ wrote: > I do realize that I need the number of elements so that I can loop over > that many times... > > > On Sun, Jul 3, 2011 at 4:30 PM, AJ wrote: > >> Hi Shawn, >> >> Thanks fo

complex query

2011-07-03 Thread Jonas Geiregat
Hello, I have the following models class Book(models.Model): author = models.ManyToManyField(Author) pub_date = models.DateTimeField() ... class Author(models.Model): tag = models.ManyToManyField(Tag) class Tag(models.Model): name = models.CharField(max_l

Re: csrf token not working

2011-07-03 Thread Hervé Edorh
With django.core.context_processor.csrf that i explain, you don't need to do anything in yours views like below. On Jul 3, 4:29 pm, Vusal Alishov wrote: > example : > in views: > def foo(request): >     c = {"foo": "bar"} >     c.update(csrf(request)) >     return render('test.html',c) -- You r

Re: error on django-admin.py startproject

2011-07-03 Thread ravinder singh
plz upgrade ur system than try to run -- 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 email to django-users+unsubscr...@googlegroups.com. F

Re: Dynamic Form Fields in Django using JavaScript

2011-07-03 Thread AJ
I do realize that I need the number of elements so that I can loop over that many times... On Sun, Jul 3, 2011 at 4:30 PM, AJ wrote: > Hi Shawn, > > Thanks for your reply. To begin with, I am trying this with a small test > app. > > I have this so far. I tried with two textarea elements on a pag

Re: Dynamic Form Fields in Django using JavaScript

2011-07-03 Thread AJ
Hi Shawn, Thanks for your reply. To begin with, I am trying this with a small test app. I have this so far. I tried with two textarea elements on a page and tried to save them but I cannot figure out how to save two elements. Each element list corresponds to one model instance or table row for Te

Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-07-03 Thread Andre Santos
Oh, sorry :). 2011/7/3 Cal Leeming [Simplicity Media Ltd] < cal.leem...@simplicitymedialtd.co.uk> > This has already been discussed earlier in the thread :) > > On Sun, Jul 3, 2011 at 4:28 PM, Andre Santos wrote: > > Maybe someone can record it and upload somewhere for the ones who cant be > > o

Re: Setting up EC2 for Django

2011-07-03 Thread Stuart
What you are describing is like trying to eat a 12-course meal in one bite. If you have no command-line experience, I don't think it's going to be a very pleasant experience for you. But here is how I would approach it.. 1) Figure out how to get Ubuntu Server running out on EC2 (http:// alestic.co

Re: csrf token not working

2011-07-03 Thread Vusal Alishov
example : in views: def foo(request): c = {"foo": "bar"} c.update(csrf(request)) return render('test.html',c) 2011/7/3 Hervé Edorh > hi, > step 3, put "django.core.context_processors.csrf" in your > TEMPLATE_CONTEXT_PROCESSORS and if you use django 1.3 use "render()" > in place of re

Re: Dynamic Form Fields in Django using JavaScript

2011-07-03 Thread Shawn Milochik
As long as, when you instantiate your Django forms.Form instance when the HTML form is posted, you create the fields passed in the form data and instantiate the fields to match you should be fine. Just go ahead and do it, and if you run into any snags post to the forum. Shawn -- You received

Dynamic Form Fields in Django using JavaScript

2011-07-03 Thread AJ
I am thinking of creating an app like Wufoo which requires adding dynamic elements in the form based on user interaction. So, to begin with I will have an empty form (with no fields). Then user will add a text-input, a text-area etc. using JavaScript on the page, on the fly. I know that Django

Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-07-03 Thread Cal Leeming [Simplicity Media Ltd]
This has already been discussed earlier in the thread :) On Sun, Jul 3, 2011 at 4:28 PM, Andre Santos wrote: > Maybe someone can record it and upload somewhere for the ones who cant be > online when you do the presentation... > > 2011/7/3 gradja >> >> > If you're interested, please reply on-list

Re: error on django-admin.py startproject

2011-07-03 Thread Phil
Thanks for all the comments everyone, it's a great help. Yes I have more than one python installed, when I got the server it had python2.4 and I read the latest django stopped supporting 2.4 so I installed python2.7 after reading this(also it said not to delete python2.4 because 'yum' needs it to

Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-07-03 Thread Andre Santos
Maybe someone can record it and upload somewhere for the ones who cant be online when you do the presentation... 2011/7/3 gradja > > > If you're interested, please reply on-list so others can see. > > Count me in, and thanks to share your experience with others. > Graziella > > -- > You received

Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-07-03 Thread gradja
> If you're interested, please reply on-list so others can see. Count me in, and thanks to share your experience with others. Graziella -- 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@googlegro

Re: csrf token not working

2011-07-03 Thread Hervé Edorh
hi, step 3, put "django.core.context_processors.csrf" in your TEMPLATE_CONTEXT_PROCESSORS and if you use django 1.3 use "render()" in place of render_to_response in yours views. Or if you want to use render_to_response put "context_instance=RequestContext(request)" at the end of render_to_response

ERROR: test_14377 (django.contrib.auth.tests.views.LogoutTest), AttributeError: 'module' object has no attribute 'handler500'

2011-07-03 Thread David Markey
Anyone any idea how to fix this, in my urls.py im explicitly doing: from django.conf.urls.defaults import handler404, handler500, include, patterns, url == ERROR: test_14377 (django.contrib.auth.tests.views.LogoutTest) -

Re: error on django-admin.py startproject

2011-07-03 Thread bruno desthuilliers
On 2 juil, 21:57, Phil wrote: > When I type "import functools" into the python > interpreter I get no errors back either. I can't make it out. > see my other answer - either you're not invoking the right Python (if you have more than one) or something messes with your sys.path. functools was ad

Re: error on django-admin.py startproject

2011-07-03 Thread bruno desthuilliers
On 2 juil, 20:31, ravinder singh wrote: > @ >   plz try this >     sudo apt-get install subversion Not all systems are debian or unbuntu, > than >       django-admin.py startproject mysite.ok In which way would it solve the OP's problem ? Django has exactly 0 (zero) dependency on subversion.

Re: error on django-admin.py startproject

2011-07-03 Thread bruno desthuilliers
On 2 juil, 20:02, Phil wrote: > Hi, > > I recently installed the latest development version of Django from > subversion. I followed all steps on site, got no errors. When I type > "import django" in Python interpreter I get no errors. > > But when I try run "django-admin.py startproject mysite" I