Re: Django and caching when data is updated

2010-01-20 Thread Russell Keith-Magee
On Thu, Jan 21, 2010 at 7:47 AM, Malcolm Box wrote: > Hi, > > On the quest for performance I'm now having a look at Django's caching > framework. > > I've got a simple question that I can't find the answer to:  if the data > that a view depends on changes, does Django do

Re: Making InlineModelAdmin objects required.

2010-01-20 Thread mattimust...@gmail.com
Hi, Take a look at http://code.google.com/p/wadofstuff/wiki/WadOfStuffDjangoForms as the RequireOneFormSet class may give you some hints on how to do this. regards Matthew On Jan 21, 3:57 pm, iliveinapark wrote: > Hi all, > > I'm wondering if there's a way to

Re: Problem with Django

2010-01-20 Thread Prashanth
Hi, On Thu, Jan 21, 2010 at 10:53 AM, Meenu wrote: > > I've noticed that my form submission seems to randomly fail on the > line var response_obj = eval('(' + o.responseText + ')'); in my > javascript. My form contains date and decimal fields. > Pretty hard to

Problem with Django

2010-01-20 Thread Meenu
I have been tinkering with Ajax today, based on this tutorial: http://www.b-list.org/weblog/2006/07/31/django-tips-simple-ajax-example-part-1 I've noticed that my form submission seems to randomly fail on the line var response_obj = eval('(' + o.responseText + ')'); in my javascript. My form

Making InlineModelAdmin objects required.

2010-01-20 Thread iliveinapark
Hi all, I'm wondering if there's a way to make InlineModelAdmin objects required, so that if a user saves on an admin page without completing the fields of the inline model, it displays big red "This field is required." Errors like it does with the included fields. Cheers. -- You received this

Re: deploying on apache as 'raw cgi' due to checkmate from mod_python etc

2010-01-20 Thread gs_toronto
Yup, it works using adapter as above and pysqlite-2.5.6. So I should be fine (until I run into some other reason why py2.3 isn't going to work for me). On Jan 20, 10:42 pm, gs_toronto wrote: > Thanks, I'll take a look at those. It also looks I was wrong about >

Re: deploying on apache as 'raw cgi' due to checkmate from mod_python etc

2010-01-20 Thread gs_toronto
Thanks, I'll take a look at those. It also looks I was wrong about 'pysqlite2' not being a replacement for 'sqlite3' in Py2.5 - it looks like they are the same but pysqlite2 is arranged a bit differently, so the same import doesn't work; but it seems an adapter can be made so that 'import sqlite3'

Re: ChoiceField

2010-01-20 Thread pinco
Hi Shawn, I spent some time playing with dir and reading the django code for forms, but to me there is no evident way to iterate through the single choices within a choicefiled. Hope I'm wrong and I missed something. On Jan 21, 9:25 am, Shawn Milochik wrote: > If this

get all foreign keys that point to

2010-01-20 Thread Ether Joe
Hello there, quick (hopefully) question for you - how do I get a list of records in a foreign table that point back to the object making the query? For example - a Formula One racing team, where each Team has 0 or more Drivers, and each Driver can be a member of only one Team. How do I get a list

Re: deploying on apache as 'raw cgi' due to checkmate from mod_python etc

2010-01-20 Thread Chris Lee-Messer
Yes, it is possible to serve django via cgi see http://code.djangoproject.com/wiki/ServerArrangements However, I would think that you would be better off one of several alternatives that use a second server to run django persistently. As one example, If you can use mod_rewrite on apache, you

Re: no attribute 'save_m2m'

2010-01-20 Thread GoSantoni
Thanks for the replies. The form works fine now Great to have such an active and accurate group On Jan 18, 9:27 pm, Daniel Roseman wrote: > On Jan 18, 7:17 pm, GoSantoni wrote: > > > I didn't alter the model but the view > > > def new(request,

Django notification loop/ cycle for blog posts created after users last_login

2010-01-20 Thread GoSantoni
Guys, I'm trying to create a loop to send notification by dango-notification for all new posts. What i'd like to do is send a notification for the posts added after the last visit of the members. Phrased otherwise I just want to send (update) users about new posts, not about old ones. Users read

Easy database modeling question

2010-01-20 Thread Chris
This is my first Django experience and I'm having trouble figuring out the right answer to the right relationship to have. (brain fart maybe.. ) I have a site that users have profiles and can message each other. So my model looks like: class User(models.Model): username =

Fixtures Initial Data - Split Into Multiple Files?

2010-01-20 Thread Victor Hooi
heya, This is a small question, is there any way for the initial_data.json/ xml/sql file to reference other files, or split it up across multiple files? Basically, I want to split up my existing monolithic files, into a separate json file for each section (I'm basically using this to populate

Re: unexpected Error: OperationalError: no such column: ...

2010-01-20 Thread Tomasz Zieliński
On 20 Sty, 20:52, HWM-Rocker wrote: > o...@olaf-laptop:~/workspace/truemen$ ./manage.py shell Not touching you question, you could try shell_plus from django- extensions, it load all models on startup, saving you a lot of typing. Moreover you could try ipython (which is

Re: Generic Relations and Django Admin?

2010-01-20 Thread Victor Hooi
heya, Hmm, I'm using generic.GenericTabularInline for the Address Inline, is that the same? class AddressAdmin(VersionAdmin): exclude = ('content_type', 'object_id',) ... class AddressInline(generic.GenericTabularInline): model = Address ... class HospitalAdmin(admin.ModelAdmin):

Re: Generic Relations and Django Admin?

2010-01-20 Thread Victor Hooi
heya, The thing is, it's a one-to-many for UserProfile/Hospital/Institution to Addresses - that is, each entity can (and probably will) have multiple addresses. That's why the FK field is on Address. Also, I thought that was the way it was traditionally modelled in database design? (I admit I'm

Django and caching when data is updated

2010-01-20 Thread Malcolm Box
Hi, On the quest for performance I'm now having a look at Django's caching framework. I've got a simple question that I can't find the answer to: if the data that a view depends on changes, does Django do anything smart to invalidate the cache for that view, or is it left to the programmer? If

pagination in a formset

2010-01-20 Thread Binu
I uses a formset factory. I only want 10 forms per page from the formset. Can I do that? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send

Re: Writing your first Django app, part 4 - 'CSRF token missing or incorrect.'

2010-01-20 Thread rolo
Karen you're a darling thank you so much. That is indeed what i did, I checked out the Dev version and somehow I ended up at the 1.1 docs. Thanks! On Jan 21, 6:28 am, Karen Tracey wrote: > On Wed, Jan 20, 2010 at 3:10 PM, rolo wrote: > > [snip] > >

Re: Writing your first Django app, part 4 - 'CSRF token missing or incorrect.'

2010-01-20 Thread Karen Tracey
On Wed, Jan 20, 2010 at 3:10 PM, rolo wrote: > [snip] > Everything worked beautifully(the docs are very nice), until I reached > the 4th and last part. (http://docs.djangoproject.com/en/1.1/intro/ > tutorial04/ )

Re: Django, manage.py and Ubuntu

2010-01-20 Thread MauroCam
Hi Bill, thank you very much for the additional advice, and for the book references - especially the latter where you pre-empted my question. As you say I have come to Django without devoting much effort to the important Python aspects, and I have realised in the past month or so that I made a

Re: ChoiceField

2010-01-20 Thread Shawn Milochik
If this kind of thing isn't clear from the documentation at docs.djangoproject.com, I recommend throwing some print/debug statements into your views to explore the objects. Take advantage of Python's introspection. For example, before you return the response in your view, try some of these

ChoiceField

2010-01-20 Thread pinco
Sorry for the trivial question but... Is there a way to access the single choices of a choicefield within a template? I would get something like: {% for choice in form.my_coicefield.choices %} {{ choice }} {% endfor %} but obviously this is not working. Many thanks in advance. Paolo

Should a decorator be used here or should I do something else.

2010-01-20 Thread Jeffrey Taggarty
Hi Guys, I have a bit of a dilemma in terms of design of a small web application... I have this requirement where content is being served by age group. On first load the user selects their age group and I store that in the cookie. I read that cookie and query content for the pages based on that

deploying on apache as 'raw cgi' due to checkmate from mod_python etc

2010-01-20 Thread gs_toronto
I have this apache installation which has mod_python, but that's bound to an existing python2.3 installation (which is in use for other web app, that uses compiled python extensions which won't work with py2.5). python2.3 doesn't have sqlite3 module (and 'pysqlite2' add-on isn't the same). So, I

Writing your first Django app, part 4 - 'CSRF token missing or incorrect.'

2010-01-20 Thread rolo
Hi Everybody, I am a new django user and this is my first time posting in this group. I have installed Django and have been working my way through the 'Writing your first Django app' series. Everything worked beautifully(the docs are very nice), until I reached the 4th and last part.

Re: Can I wrap the "extends" tag in an "if" tag?

2010-01-20 Thread Bill Freeman
But then you have to include the header content in every template that extends base.html which sort of defeats (part of) the purpose of extends. On Wed, Jan 20, 2010 at 4:40 PM, Tim wrote: > Could you do it in a block? > > In base.html > > {% block header %}{% endblock%} >

Re: Can I wrap the "extends" tag in an "if" tag?

2010-01-20 Thread Tim
Could you do it in a block? In base.html {% block header %}{% endblock%} {% block content %}{% endblock %} Then in template.html: {% extends "base.html" %} {% block header %} {% if show_header %} Showing the header. {% endif %} {% endblock%} {% block content %} This will

Re: Calendaring

2010-01-20 Thread Jeff Bell
This is a pretty cool implementation http://github.com/justinlilly/django-gencal On Wed, Jan 20, 2010 at 3:40 PM, Shane Graber wrote: > Is there a calendaring app that people really like to use with Django? > What's the most popular one at the moment? > > Shane > > -- >

Re: Can I wrap the "extends" tag in an "if" tag?

2010-01-20 Thread Chris P. Vigelius
Stodge schrieb: > Can I wrap the "extends" tag in an "if" tag? I tried it but I get: [...] > Is there another way of doing this? I want my view to control whether > the header is displayed or not. {% extends %} also takes a variable (instead of a static string), so you could define two parent

Calendaring

2010-01-20 Thread Shane Graber
Is there a calendaring app that people really like to use with Django? What's the most popular one at the moment? Shane -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To

Re: Iterating over a QuerySet

2010-01-20 Thread Olivier Guilyardi
On 01/20/2010 08:41 PM, Daniel Roseman wrote: > On Jan 20, 7:09 pm, Olivier Guilyardi wrote: >> For best performances, should I: >> >> records = MyModel.objects.all() >> for item in records: >> ... >> >> or is the following ok: >> >> for item in MyModel.objects.all(): >>

unexpected Error: OperationalError: no such column: ...

2010-01-20 Thread HWM-Rocker
Hello Everybody, i got a strange error when i am trying to test some code out of pycrust. I have a small script that sets the environment variable and starts pycrust. o...@olaf-laptop:~/workspace/truemen$ cat debug-shell.sh #!/bin/bash cd /home/olaf/workspace/ && export

Re: Iterating over a QuerySet

2010-01-20 Thread Daniel Roseman
On Jan 20, 7:09 pm, Olivier Guilyardi wrote: > For best performances, should I: > > records = MyModel.objects.all() > for item in records: >     ... > > or is the following ok: > > for item in MyModel.objects.all(): >     ... > > ? There is no difference, except for the

Iterating over a QuerySet

2010-01-20 Thread Olivier Guilyardi
For best performances, should I: records = MyModel.objects.all() for item in records: ... or is the following ok: for item in MyModel.objects.all(): ... ? -- Olivier -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: wsgi - apache/nginx - why use nginx?

2010-01-20 Thread Itay Donenhirsch
thanks for all the replies folks, you've been very helpful. On Wed, Jan 20, 2010 at 7:49 PM, Javier Guerra wrote: > On Wed, Jan 20, 2010 at 12:42 PM, Chris Czub wrote: >> Look into what is called a "reverse proxy" e.g. Squid > > ... or put the static

Re: eurodjangocon?

2010-01-20 Thread Victor Loureiro Lima
metatags? Victor Lima 2010/1/20 Reinout van Rees > On 01/20/2010 08:41 AM, Alex_Gaynor wrote: > >> >> http://djangocon.eu/ is the official website for djangocon.eu (the new >> name). >> > > Please mention the old eurodjango name somewhere on that page so that > google can

Re: wsgi - apache/nginx - why use nginx?

2010-01-20 Thread Javier Guerra
On Wed, Jan 20, 2010 at 12:42 PM, Chris Czub wrote: > Look into what is called a "reverse proxy" e.g. Squid ... or put the static files server in port 80 and make it proxy the app ... or use mod_wsgi in daemon mode ... or use FastCGI instead of mod_python -- Javier --

Re: wsgi - apache/nginx - why use nginx?

2010-01-20 Thread Chris Czub
>1. my apache server on port 80 serves both a normal site (php) and the >django files. i would like to keep my normal site on port 80. is there >a way to keep it that way? as far as i understand the two servers must >be running on different ports. Look into what is called a "reverse proxy" e.g.

Re: wsgi - apache/nginx - why use nginx?

2010-01-20 Thread Itay Donenhirsch
thanks for the detailed and concise reply! i have two more question though: 1. my apache server on port 80 serves both a normal site (php) and the django files. i would like to keep my normal site on port 80. is there a way to keep it that way? as far as i understand the two servers must be

Re: Splitting tests.py

2010-01-20 Thread Olivier Guilyardi
On 01/20/2010 01:21 PM, Matt Schinckel wrote: > On Jan 20, 9:25 pm, Olivier Guilyardi wrote: [...] >> Please see my last mail, this issue is resolved. Indeed it was import-related >> and silently failing. > > Yes, it came through as I was replying :) Then I think that it would

Re: Can I wrap the "extends" tag in an "if" tag?

2010-01-20 Thread Bill Freeman
My understanding is that you cannot. The docs say that extends, if present must be the first thing in the file (whitespace and maybe comments notsithstanding). But you could easily enough contrive the particular kind of control in your example by using if tags in base.html (or something that it

Re: Django, manage.py and Ubuntu

2010-01-20 Thread Bill Freeman
On Tue, Jan 19, 2010 at 7:57 PM, MauroCam wrote: > Bill, > > thanks for all your help. I have fixed it by manually saving > PYTHONPATH in.profile, and the sys.path is now reflecting the correct > path. Runnnig the loaddata command now correctly loads the data! > > Not sure

Re: Followup on the Montréal Sprint

2010-01-20 Thread Russell Keith-Magee
On Tue, Jan 19, 2010 at 10:59 PM, Yannick Gingras wrote: > > Greetings, >  The django translation sprint was a clear success.  A team of eight > sprinters worked on the Django documentation and after an intense > training session on the toolchain, we were able complete a

Can I wrap the "extends" tag in an "if" tag?

2010-01-20 Thread Stodge
Can I wrap the "extends" tag in an "if" tag? I tried it but I get: Invalid block tag: 'endif' {% if show_header %} {% extends "base.html" %} {% endif %} Is there another way of doing this? I want my view to control whether the header is displayed or not. Thanks -- You received this

Re: Admin site pages + display or hiding instance owner field

2010-01-20 Thread Massimiliano della Rovere
Solved. It seems this is due to the 1.2 alpha1 bug involving form.is_valid(): http://www.pubbs.net/django/201001/16447/ reverting to django 1.1 solved all my problems On Wed, Jan 20, 2010 at 10:25, Massimiliano della Rovere < massimiliano.dellarov...@gmail.com> wrote: > Ok I managed to remove

Re: Announce: django-ldap-groups

2010-01-20 Thread Peter Herndon
On Jan 19, 2010, at 9:11 PM, Mike Dewhirst wrote: > On 6/08/2009 10:15am, Peter Herndon wrote: >> >> I'm pleased to announce the release of django-ldap-groups. Of special >> interest for building intranet sites, django-ldap-groups allows Django >> users to authenticate against LDAP, and allows

Re: wsgi - apache/nginx - why use nginx?

2010-01-20 Thread Javier Guerra
On Wed, Jan 20, 2010 at 10:24 AM, Itay Donenhirsch wrote: > the question is - why use nginx at all? why not let apache serve the > static files as well? what's escaping me? the mod_python module runs Django (or any python code) in the same process than the rest of apache. that

Recursive model

2010-01-20 Thread Alessandro Ronchi
I tried to make a resursive model: http://dpaste.com/147941/ but in admin I cannot see dipende_da widget. In shell I have. segnalazione.dipende_da (,) My admin is : http://dpaste.com/147940/ Do you know what's wrong? -- Alessandro Ronchi http://www.soasi.com SOASI - Sviluppo Software e

wsgi - apache/nginx - why use nginx?

2010-01-20 Thread Itay Donenhirsch
hi folks, i recently deployed a django powered site using apache and wsgi alone, without using nginx. what's odd to me is that all the manuals/howtos i found explained how to deploy the site using combination of apache and nginx. the question is - why use nginx at all? why not let apache serve the

Re: Database queries using django models framework.

2010-01-20 Thread Karen Tracey
On Wed, Jan 20, 2010 at 9:23 AM, django_user wrote: > Thanks Alex, > I tried it, and it results in 3 queries. > > Actually the code you posted issues no queries, it simply creates three independent lazily-evaluated QuerySets. When you subsequently do something to trigger

Re: eurodjangocon?

2010-01-20 Thread Reinout van Rees
On 01/20/2010 08:41 AM, Alex_Gaynor wrote: http://djangocon.eu/ is the official website for djangocon.eu (the new name). Please mention the old eurodjango name somewhere on that page so that google can find it. I was also searching in vain :-) Reinout -- Reinout van Rees -

Re: Database queries using django models framework.

2010-01-20 Thread django_user
Thanks Alex, I tried it, and it results in 3 queries. On Jan 20, 12:44 pm, Alex_Gaynor wrote: > On Jan 20, 12:46 am, django_user wrote: > > > I am not sure if the following statements in Django/Mysql will result > > in one or three database queries. >

Custom templates names for application in a project

2010-01-20 Thread Alejandro Mezcua
Hi. I'm finishing an application to manage an address book and I have a doubt on how to customize the template names for the projects that use that application. The application is named "addresslist" and it provides to urls that use generic views, one for a list and one for details. The objects

Re: Splitting tests.py

2010-01-20 Thread Matt Schinckel
On Jan 20, 9:25 pm, Olivier Guilyardi wrote: > On 01/20/2010 10:58 AM, Matt Schinckel wrote: > > > On Jan 19, 7:21 am, Olivier Guilyardi wrote: > >> On 01/18/2010 10:04 PM, Ramiro Morales wrote: > > >>> On Mon, Jan 18, 2010 at 4:40 PM, Olivier Guilyardi

Re: the configuration of nginx/django/fastcgi,can't find the static file

2010-01-20 Thread CCC
any one can help,thanks in advance On Jan 20, 2:37 pm, CCC wrote: > hi ,now i want  to deploy my website to nginx,,use ubuntu, > then myproject is located at /home/x/myproject/ , > here is my configuration,thank you very much: > user www-data; > worker_processes 2; > >

Caching user_passes_test calls

2010-01-20 Thread Oli Warner
Something I've noticed about the user_passes_test decorator is it does not cache. While I can see data-freshness being an issue (ie if you change a permission and the old result has to expire before the permission is applied) a complex test can cause quite a bit of database IO and slow things down

How to Model a relationship on a constrained subset of the foreign key.

2010-01-20 Thread taliesin
HI. I have a newbie-ish question, if that's alright. I don't know how to model a particular relationship in Django. I have an Account model which represents a customer account - billing address, balance and all that. And I have a Contact model, which represents actual people we would pick up

Re: TypeError: 'float' object is not iterable

2010-01-20 Thread Simon Brunning
2010/1/20 Christopher Bird : > Hi > > Im trying iterating over a dictionary. > i have no problem with this but when i get to the last key:value > ( value is a list) i get the following error > > > value= list > TypeError: 'float' object is not iterable > > > > django

Re: Splitting tests.py

2010-01-20 Thread Olivier Guilyardi
On 01/20/2010 10:58 AM, Matt Schinckel wrote: > On Jan 19, 7:21 am, Olivier Guilyardi wrote: >> On 01/18/2010 10:04 PM, Ramiro Morales wrote: >> >> >>> On Mon, Jan 18, 2010 at 4:40 PM, Olivier Guilyardi wrote: Hi, I'm trying to split tests.py into

Re: some modifications of Django admin change_list

2010-01-20 Thread SlafS
any chance for help? please. On 20 Sty, 00:43, SlafS wrote: > Hi there! > > I need to do some changes in the django admin change_list template (I > think so). What I need is to add some class or id (html) to every > displayed row (that list is a tree with mptt) so i can add a

Re: Filtering only on Annotations

2010-01-20 Thread pjrhar...@gmail.com
On Jan 20, 1:36 am, Russell Keith-Magee wrote: > On Wed, Jan 20, 2010 at 3:42 AM, Collin Anderson > > wrote: > > Is there anyway to have the filter only apply to the annotation, so it > > would return all publishers, with some having a

Re: authentication and an http POST from a java applet

2010-01-20 Thread pjrhar...@gmail.com
On Jan 18, 10:58 pm, stephendwolff wrote: > I'm having problems authenticating an http POST from a java applet > (which is loaded from a fully authenticated django view). I had to do a similar thing from flash. I ended up manually putting the session cookie into the

Re: Splitting tests.py

2010-01-20 Thread Matt Schinckel
On Jan 19, 7:21 am, Olivier Guilyardi wrote: > On 01/18/2010 10:04 PM, Ramiro Morales wrote: > > > > > > > On Mon, Jan 18, 2010 at 4:40 PM, Olivier Guilyardi wrote: > >> Hi, > > >> I'm trying to split tests.py into individual files into a tests/ > >> subfolder, but

Re: Admin site pages + display or hiding instance owner field

2010-01-20 Thread Massimiliano della Rovere
Ok I managed to remove the compilatore field from the form (this RowModelAdmin class is used by many Models, all having the compilatore field) def get_form(self, request, obj=None, **kwargs): form = super(RowModelAdmin, self).get_form(request, obj, **kwargs) if not request.user.is_superuser: del

Re: ANN: LFC - a CMS

2010-01-20 Thread Kai Diefenbach
On 2010-01-20 09:33:45 +0100, YoungKing said: There must be something wrong with your project permission setting,I can't see and have no permission to access the issues. Fixed. Thanks Kai-- You received this message because you are subscribed to the Google Groups "Django users" group. To

cache for "large" files like pdf

2010-01-20 Thread hinnack
Hi, I am using memcached for caching my sites. The documentation says when not to use it: http://code.google.com/p/memcached/wiki/WhyNotMemcached one point is output larger 1 MB I have a site producing pdf files only, where size can easily go over 1 MB. As the docs above mention mogilefs as an

Re: ANN: LFC - a CMS

2010-01-20 Thread YoungKing
Hi, There must be something wrong with your project permission setting,I can't see and have no permission to access the issues. On Wed, Jan 20, 2010 at 3:53 PM, Kai Diefenbach wrote: > Hi, > > > On 2010-01-19 12:59:13 +0100, YoungKing said: > > > hello, it doen't work

Re: My Own Auth Backend

2010-01-20 Thread Olivier Détour
Up 2010/1/18 Olivier Détour : > Thanks for this link, I saw it Saturday. > But the problem is the same, I have to login to use template like that: > > {% if user.is_authenticated %} >  lol > {% else %} >  not lol > {% endif %} > > and my view.py is somethink like that: > >  

Why oh why are my cache settings being ignored?!?!?

2010-01-20 Thread Ben Scherrey
No browser seems to be honoring my cache settings. They all keep making the full request each time. We really need clients to do some local caching but I can't figure out how to get them to do it. The following request/response is repeated absolutely identically (except for time stamps) within a