Re: Addng extra variable to request sent by self.client.get() when using django TestCase

2011-11-08 Thread nav
Thanks RequestFactory does exactly what I needed it is a pity that I had ignored it while going through the docs. There is however one question I have is it possible to check what template was used to render the content. The assertTemplateUsed() method looks for a response.templates attribute

Re: Changes to default project layout?

2011-11-08 Thread Victor Hooi
heya, Also, I noticed that there's no models.py file in the first app that startproject creates - I assume this is by design, right? Hmm, what's the rationale behind it? Cheers, Victor -- You received this message because you are subscribed to the Google Groups "Django users" group. To

Changes to default project layout?

2011-11-08 Thread Victor Hooi
heya, *NB: Not sure if this belongs in dev or general, but I'm assuming here - please let me know if I'm wrong.* I just noticed there was a change made to startproject/startapp, and the default Django layout in trunk (yes, I'm a bit behind the curve...haha).

Re: How can I serve static files while requiring Django-based access permissions?

2011-11-08 Thread zak
Thank you, that is a very helpful suggestion. However, I have a followup question. What are my options if: 1. It is okay to be slow (low performance), and 2. The method must work on any webserver, not necessarily or specifically Apache or Nginx. In pure Python/Django, how do I open a file on

Re: template information in django view

2011-11-08 Thread Daniel Roseman
On Tuesday, 8 November 2011 18:39:12 UTC, jay K. wrote: > > > Hello, > > Is there any way I could retrieve information about a template, > such as template name, url, etc inside a view? is there built-in > object that represents the template object? > > thanks > > regards > > You seem

Re: How can I serve static files while requiring Django-based access permissions?

2011-11-08 Thread Ian Clelland
On Tue, Nov 8, 2011 at 2:11 PM, zak2011 wrote: > Dear Django Users, > > tl;dr: Please tell me what strategies I might use to serve a large > static file from within Django, from views.py. > > If I want to limit access to a particular page in a Django app, I can > do something

How can I serve static files while requiring Django-based access permissions?

2011-11-08 Thread zak2011
Dear Django Users, tl;dr: Please tell me what strategies I might use to serve a large static file from within Django, from views.py. If I want to limit access to a particular page in a Django app, I can do something like this in views.py: (Note: I will use four periods to indent, because spaces

Re: How to load data to auth_permissions from initial_data.json when the auth_groups is also loaded from fixture?

2011-11-08 Thread Jason
I'm investigating this as well. I just read that using the natural keys dumpdata option might help. https://docs.djangoproject.com/en/dev/topics/serialization/#topics-serialization-natural-keys On Oct 28, 9:48 am, ycseattle wrote: > Hi, > > In my application, I have fixed

Linking ManyToMany relationship to dynamically update from values of an html SelectBox

2011-11-08 Thread Newton B
I have the following models class Group(models.Model): name = models.CharField(max_length=32, unique=True) class Subgroup(models.Model): name = models.CharField(max_length=32, unique=True) group = models.ForeignKey(Group) class KeywordsList(models.Model): name =

Re: render_to_response pointing to multiple templates

2011-11-08 Thread jay K.
Hello, Tom thanks for your answer I believe it can be done like the way you suggested I should clarify that I am new to django and have no web developing background, so my questions may sound a bit silly sometimes I got another one, if you dont mind how can I retrieve information on a

template information in django view

2011-11-08 Thread jay K.
Hello, Is there any way I could retrieve information about a template, such as template name, url, etc inside a view? is there built-in object that represents the template object? thanks regards -- You received this message because you are subscribed to the Google Groups "Django users"

Re: maultiple .js files for debug and one minimized .js for production

2011-11-08 Thread Fabian Ezequiel Gallina
2011/11/8 Andres Reyes > I've been using django-compressor and totally recommend it > > > https://github.com/mintchaos/django_compressor > > > I second that, works like charm and I really like the way it solved the thing with a templatetag instead of having to define file

Re: How to call an API? (django-dynamicresponse)

2011-11-08 Thread Benjamin Buch
Found the answer while reading the piston documentation: curl -H "Accept: application/json" http://127.0.0.1:8000/api/; The -H option allows to pass a custom header to the server. Best, Benjamin -- You received this message because you are subscribed to the Google Groups "Django users"

Re: maultiple .js files for debug and one minimized .js for production

2011-11-08 Thread Andres Reyes
I've been using django-compressor and totally recommend it https://github.com/mintchaos/django_compressor 2011/11/8 Gelonida N > Hi, > > > I'm having an rather weak (CPU) server accesible over a rather slow > network. > > Therfore my plan is to use > multiple readable

How to call an API? (django-dynamicresponse)

2011-11-08 Thread Benjamin Buch
I'm new to APIs and played around with https://github.com/funkbit/django-dynamicresponse today. I get no errors, but it seems that I'm not able to call the API correctly. I configured the URLs so that the view available under http://127.0.0.1:8000/api/ returns SerializeOrRender. But when I call

Re: Nested formsets at Django 1.3

2011-11-08 Thread Ilya
The validation error happens when the formset is passed an empty dictionary. The docs (release notes for 1.3) suggest passing None instead. So doing this should fix the problem: > > TenantFormset(data=self.data or None, instance=instance, prefix='TENANTS_%s' % pk_value) In my case, which is

url parameters in Formwizard

2011-11-08 Thread Alexander Ayasca Esquives
I'm using the development version of django-formwizard (https://docs.djangoproject.com/en/dev/ref/contrib/formtools/form-wizard/), how could I send parameters through a url to a wizardview ? this is mi url: r'^buscar/control/(?P\d+)', form_control_nino.as_view([ ControlForm,], ) thanks --

Re: Feature request: queryset caching inside a request

2011-11-08 Thread Tom Evans
On Tue, Nov 8, 2011 at 5:02 PM, Chase wrote: > I agree that the kind of queries that are repeated tend to be light > weight ones. The only reason I started looking at this was due to some > higher than average latency between servers in our hosting > environment. > > When

Re: Feature request: queryset caching inside a request

2011-11-08 Thread Chase
I agree that the kind of queries that are repeated tend to be light weight ones. The only reason I started looking at this was due to some higher than average latency between servers in our hosting environment. When you're spending an extra 10m per query, even the light ones count.

Default doctest options

2011-11-08 Thread Tobia Conforto
Hi Is there a recommended way to set default doctest options? (per doctest, per app, or even per project would be ok) I'm thinking of REPORT_NDIFF in particular, which is essential when testing large xml serializations and such. Tobia -- You received this message because you are subscribed to

Re: change Django administration name

2011-11-08 Thread Tom Evans
On Tue, Nov 8, 2011 at 4:46 PM, Nicolas wrote: > Dear all, > I'm almost at the end of the tutorial part 2 but I can't manage to > change "Django administration" to something different. What I did: > - create a template/admin subdirectory into the folder containing all >

change Django administration name

2011-11-08 Thread Nicolas
Dear all, I'm almost at the end of the tutorial part 2 but I can't manage to change "Django administration" to something different. What I did: - create a template/admin subdirectory into the folder containing all the files related to mysite (it looks like this; C:/Users/songbird/

Re: CSRF failures for users that block all cookies. Is my planned solution stupid?

2011-11-08 Thread Tim Chase
On 11/08/11 01:13, Kevin wrote: These ~5% of your userbase is most likely like myself, where I block all cookies and add specific sites to an exception list. ... Another idea is to fetch the form via AJAX and render it using Javascript onto the page. Just a note: if these ~5% are taking the

Re: Feature request: queryset caching inside a request

2011-11-08 Thread Tom Evans
On Tue, Nov 8, 2011 at 4:07 PM, Chase wrote: > Has anyone else ever been surprised by the number of duplicate > database queries when looking at the Django debug toolbar output? > > In my application, we have models for Users, Profiles and Companies. > Many of our methods

Re: Template

2011-11-08 Thread Hůla , Václav
2011/11/8 Andre Terra : > I stand corrected. I must have read the OP too fast. Well, I believe it's > been answered then! :) If it was a typo, having 'bar' in context whoulnt have sense. Thanks for your time, I will go Tom Evans way with dict_get tag, as I dont see how to

Feature request: queryset caching inside a request

2011-11-08 Thread Chase
Has anyone else ever been surprised by the number of duplicate database queries when looking at the Django debug toolbar output? In my application, we have models for Users, Profiles and Companies. Many of our methods take a user as a parameter, and then look up the related profile and/or

Re: Template

2011-11-08 Thread Andre Terra
I stand corrected. I must have read the OP too fast. Well, I believe it's been answered then! :) Cheers, AT On Tue, Nov 8, 2011 at 12:51 PM, Tom Evans wrote: > On Tue, Nov 8, 2011 at 2:31 PM, Andre Terra wrote: > > Actually, judging by his

Re: Template

2011-11-08 Thread Hůla , Václav
2011/11/8 Andre Terra : > I think you have a typo! Try {{ foo.baz }} instead ;-) No, no typos here. I dont want to do foo["baz"], but foo[bar] (in my case, i want to iterate over an ordered list and work with values from dictionary which has keys equal to list items) Ax --

Re: Addng extra variable to request sent by self.client.get() when using django TestCase

2011-11-08 Thread Flavia Missi
When I need something like you want, I usually use RequestFactory to create the request and call the view directly. You can see an example here https://gist.github.com/1348085 Hope that helps ;) []'s On Tue, Nov 8, 2011 at 12:21 PM, nav wrote: > Dear Folks, > > While

Re: Template

2011-11-08 Thread Tom Evans
On Tue, Nov 8, 2011 at 2:31 PM, Andre Terra wrote: > Actually, judging by his 'context' variable, he is not. I'm attributing > the"foo[bar]" (sic) in his question to a newbie typo, rather. > > I don't particularly want to argue this point, but: A dictionary in the context

Re: Template

2011-11-08 Thread Andre Terra
Actually, judging by his 'context' variable, he is not. I'm attributing the"foo[bar]" (sic) in his question to a newbie typo, rather. Cheers, AT On Tue, Nov 8, 2011 at 12:28 PM, Tom Evans wrote: > 2011/11/8 Andre Terra : > > I think you have a

Re: Template

2011-11-08 Thread Tom Evans
2011/11/8 Andre Terra : > I think you have a typo! Try {{ foo.baz }} instead ;-) > > No, look closer, he's trying to do variable interpolation. Cheers Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: Template

2011-11-08 Thread Daniel Molina Wegener
On Tuesday 08 November 2011, "Hůla, Václav" wrote: > Hello. > How I do equivalent of foo[bar] in template? From documentation it > looks like it should be done automatically - see > https://docs.djangoproject.com/en/1.3/ref/templates/api/#render > > But: > >>> from

Re: Template

2011-11-08 Thread Andre Terra
I think you have a typo! Try {{ foo.baz }} instead ;-) Cheers, AT 2011/11/8 Hůla, Václav > Hello. > How I do equivalent of foo[bar] in template? From documentation it > looks like it should be done automatically - see >

Addng extra variable to request sent by self.client.get() when using django TestCase

2011-11-08 Thread nav
Dear Folks, While testing my application I found out that the middleware that implements process_request is not run. This is fine as long as I can add the required field to the request object before passing the required URL to self.client.get(). what I want to do is something like this

Re: Template

2011-11-08 Thread Tom Evans
2011/11/8 Hůla, Václav : > Hello. > How I do equivalent of foo[bar] in template? From documentation it > looks like it should be done automatically - see > https://docs.djangoproject.com/en/1.3/ref/templates/api/#render > > But: > from django.template import Context,

Template

2011-11-08 Thread Hůla , Václav
Hello. How I do equivalent of foo[bar] in template? From documentation it looks like it should be done automatically - see https://docs.djangoproject.com/en/1.3/ref/templates/api/#render But: >>> from django.template import Context, Template >>> t = Template("Will ot work? {{ foo.bar }}") >>>

Re: How to

2011-11-08 Thread Tom Evans
On Tue, Nov 8, 2011 at 12:25 PM, Andre Terra wrote: > On Tue, Nov 8, 2011 at 12:40 AM, Russell Keith-Magee > wrote: >> >> If you ask a query to output its SQL, what is displayed is not exactly >> equivalent to what is passed to the underlying query

Re: How to

2011-11-08 Thread Andre Terra
On Tue, Nov 8, 2011 at 12:40 AM, Russell Keith-Magee < russ...@keith-magee.com> wrote: > If you ask a query to output its SQL, what is displayed is not exactly > equivalent to what is passed to the underlying query engine. Django > uses a standard Python database API to access the database. That

Re: Reverse for 'mysite.polls.views.results' with arguments '(1L,)' and keyword arguments '{}' not found

2011-11-08 Thread Andre Terra
You are passing one positional argument to your view with the value of 1L (the L is for long integers), and an empty dict for the keyword arguments. Check your mysite.polls.views.results URL mapping in urls.py and see what it's expecting. My bet is that your missing a \d wildcard in your regex.

Reverse for 'mysite.polls.views.results' with arguments '(1L,)' and keyword arguments '{}' not found

2011-11-08 Thread 香柱元
I just run into the tutorial part 4,and at the last of the psot. I got a error message: *Reverse for 'mysite.polls.views.results' with arguments '(1L,)' and keyword arguments '{}' not found* * * *who can tell me what's up?* *thanks!* -- You received this message because you are subscribed to

Re: bar charts

2011-11-08 Thread Venkatraman S
I have documented a set of viz libraries: http://blizzardzblogs.blogspot.com/2010/12/data-visualization-charts-and.html -V- -- 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

Re: bar charts

2011-11-08 Thread kenneth gonsalves
On Tue, 2011-11-08 at 21:16 +1100, Mario Gudelj wrote: > I'm a Django/Python beginner, but the above works for me and it plots > the number of items per month, where the Y-axis is the number of items > and X-axis is the month names. I found it faster and more efficient to generate the DataTable

Re: Is there a standard way to implement the top level of my site?

2011-11-08 Thread Tom Evans
On Mon, Nov 7, 2011 at 10:51 PM, M. Herold wrote: > With that, I'm trying to link a static style.css file for development, > but it's not working worth a damn: > > if settings.DEBUG: >    urlpatterns += patterns('', >        (r'^static/(?P.*)$',

Re: CSRF failures for users that block all cookies. Is my planned solution stupid?

2011-11-08 Thread Tom Evans
Disclaimer: I am not a security expert On Tue, Nov 8, 2011 at 7:13 AM, Kevin wrote: > Yes, this will open your site up to attack, as most bots never send > cookies.  Take a look at how the shell programs curl and wget > function, both of them never send a cookie, unless the

Re: bar charts

2011-11-08 Thread Mario Gudelj
Hey, I implemented a line chart and this is my code: View: def render_chart(request): months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'] month_values = [0,0,0,0,0,0,0,0,0,0,0,0] list_of_items = MyModel.objects.all() for item in list_of_items:

Re: ZeroMQ / Mongrel2

2011-11-08 Thread Tom Evans
On Mon, Nov 7, 2011 at 11:58 PM, Markus Gattol wrote: > > Maybe sombody has given http://code.google.com/p/django-dmq and Mongrel2 a > spin already and can report how it went? The reason I am interested is > because it would allow me to get rid of WSGI altogether and

maultiple .js files for debug and one minimized .js for production

2011-11-08 Thread Gelonida N
Hi, I'm having an rather weak (CPU) server accesible over a rather slow network. Therfore my plan is to use multiple readable debuggable css files for debugging and a single, minizmized .js for for production. This will affect some of my templates. How do you handle this setup in your