ForeignKey to User

2011-01-18 Thread Praveen Krishna R
*Hi,* * * *Could any of you tell me about the things which I should take care while defining a * *foreign key to User model. ? * * * *Do I need to define the related_name ='+' as it says in the documentation? and what does it do?* * user = models.ForeignKey(User, related_name='+') * -- *Praveen

django custom signals

2011-01-18 Thread Mo Mughrabi
Hi, am having problem with django custom signals not being able to see signals across application. I made a simple call in my *core/signals.py* * from django.dispatch.dispatcher import Signal* *# Signal-emitting code... emits whenever a file upload is received* *#

Re: django-admin.py not working?

2011-01-18 Thread Derek
You're right - they don't (and you can suggest they do - other code on the same page does show this e.g. python manage.py runserver). However... Django is written in Python and it does say right on the "Getting started" page (http://docs.djangoproject.com/en/dev/intro/) that "If you’re new to Pyt

Re: newbie

2011-01-18 Thread Derek
1) I have not had any problems or conflicts; just make sure you load the .js libraries into whichever pages need them (using a "parent" template is probably the most sensible way). 2) You can only use .js inside templates - it does not make sense to use them elsewhere - templates deal with your ap

Re: Django forms

2011-01-18 Thread Derek
First read and understand: http://docs.djangoproject.com/en/dev/topics/forms/modelforms/ Then: 1. http://stackoverflow.com/questions/1645444/django-modelform-accessing-a-fields-value-in-the-view-template 2. http://neverfear.org/blog/view/123/Auto_Generate_Forms_With_Django_s_ModelForm On Jan 16

Re: django custom signals

2011-01-18 Thread bruno desthuilliers
On 18 jan, 10:08, Mo Mughrabi wrote: > Hi, > > am having problem with django custom signals not being able to see signals > across application. I made a simple call in my > > *core/signals.py* > >   *  from django.dispatch.dispatcher import Signal* > *    # Signal-emitting code... emits whenever a

Re: Dates BC

2011-01-18 Thread Ben Dembroski
Thanks. I do need to do some basic date arithmetic, but it doesn't really need to be super accurate. I might be able to get away with this approach. Thanks for the advice! Best, Ben On Jan 17, 10:52 pm, Christophe Pettus wrote: > On Jan 17, 2011, at 2:00 PM, Ben Dembroski wrote: > > > I'm a

Re: Dates BC

2011-01-18 Thread Alex Kamedov
Hi! I have the same problem in one of my projects. I used 2 fields for it. One is standart DateField and another is BooleanField. If the second is True I suppose the date is BC. This aprouch is very simply and work with all Django supported databases. On Tue, Jan 18, 2011 at 3:52 AM, Christophe P

Re: ForeignKey to User

2011-01-18 Thread Ivo Brodien
from the docs: If you'd prefer Django didn't create a backwards relation, set related_name to '+'. For example, this will ensure that the Usermodel won't get a backwards relation to this model: If your Model is called: MyModel then you could do for a user instance: user.mymodel_set , but if y

Automatic parent link with multi-table inheritance

2011-01-18 Thread Alendit
Hi, according to Django docs (http://docs.djangoproject.com/en/1.2/topics/ db/models/#multi-table-inheritance) there should be a automaticly set parent link, when using multi-table inheritance. I'd like to do something like that: Class A(models.Model): . Class B(A): . a = A.obje

Django saving problem, logging in/out fixes it

2011-01-18 Thread Stefan
Hi, Currently we're having some issues with a user of our product who uses a proxy on their internal network. According to their system administrator the proxy is open to port 80 and 443, and doesn't do anything with cookies and such, only blocks out some sites. Now, with Django we wrote an appl

Re: ForeignKey to User

2011-01-18 Thread Praveen Krishna R
*Thank You * On Tue, Jan 18, 2011 at 12:08 PM, Ivo Brodien wrote: > > from the > docs > : > > If you'd prefer Django didn't create a backwards relation, set > related_name to '+'. For example, this

Re: a chicken and egg - help please?

2011-01-18 Thread David De La Harpe Golden
On 18/01/11 07:26, Jani Tiainen wrote: > It's just not possible to run any arbitrary Python code > in a database. Well, technically there's a pl/python module for postgresql. ;-) (doesn't really help, I'm just saying) http://www.postgresql.org/docs/9.0/interactive/plpython.html -- You receive

404 view -> redirect to index

2011-01-18 Thread galago
I try to redirect from 404 view to my index page. In url.py i added: handler404 = 'index.views.custom404' in my index i have: def custom404(request): return HttpResponseRedirect(reverse('index')) But it doesn't work. Should I do something more? -- You received this message because you

Re: 404 view -> redirect to index

2011-01-18 Thread Ivo Brodien
Are you sure, that you have a url pattern called ‘’view? in reverse you have to pass the name of the rule, not the views method name. On 18.01.2011, at 13:22, galago wrote: > I try to redirect from 404 view to my index page. In url.py i added: > handler404 = 'index.views.custom404' > > in my i

Re: 404 view -> redirect to index

2011-01-18 Thread galago
Yes I have a index pattern: urlpatterns = patterns('', url(r'^$', 'index.views.index', name='index'),... When I add print to my method: def custom404(request): print 'foo' return HttpResponseRedirect(reverse('index')) It prints out but it doesn't redirect me to index. Instead it d

Re: listpage question

2011-01-18 Thread Bobby Roberts
does modelb.modelavalue need a FK relationship with modela.id or does django do this automatically? On Jan 17, 11:15 pm, Vovk Donets wrote: > 2011/1/18 Bobby Roberts > > > > > let's say  i have two simple models > > > model a > > id=IntegerField... > > description = CharField... > > > model b

Re: 404 view -> redirect to index

2011-01-18 Thread Ivo Brodien
I guess that django catches the 404 Error Code somehow somewhere else than in the handler? Maybe you have to set the HTTP Code to 200? On 18.01.2011, at 13:35, galago wrote: > Yes I have a index pattern: > urlpatterns = patterns('', > url(r'^$', 'index.views.index', name='index'),... >

Re: 404 view -> redirect to index

2011-01-18 Thread Thomas
why just not copy the 'templates/index.html' template to 'templates/404.html' - ready *not*sure*about*the*correctness*of*this* Am 18.01.2011 um 13:42 schrieb Ivo Brodien: > I guess that django catches the 404 Error Code somehow somewhere else than in > the handler? Maybe you have to set the

Re: 404 view -> redirect to index

2011-01-18 Thread Thomas
The book "The definitive Guide to Django" says on page 476: ---8<--- ... if you want to override the 404 view, you can specify 'handler404' in your URLconf, like so: from django.conf.urls.defaults import * urlpatterns = patterns ('', ... ) handler404 = 'mysite.views.my_custom_404_view' B

How to plug in Python: CGI

2011-01-18 Thread ashdesigner
Hello, On my VPS, I've got Apache running on MS Windows Server 2008 R2. What is the best way you suggest to plug in Python to be used in a relatively highly loaded webproject (on Django)? mod_python, fastCGI?... What are advantages and drawbacks, from your real experience? I'm new to both Python a

Pinax: worth installing?

2011-01-18 Thread ashdesigner
Guys, are there any considerable drawbacks of using Pinax for Django? Is it worth installing, or is it better to launch and develop on "pure" Django? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-use

Re: Fwd: PostGISAdapter error

2011-01-18 Thread Derek
Not an answer, I know, but did you try the GeoDjango group? http://groups.google.com/group/geodjango/topics On Jan 17, 7:31 pm, "Robinson B. Heath" wrote: > It has been a couple of weeks without a reply.  Is there somewhere else I > should post this or am I on my own? > > Begin forwarded messag

Re: Pinax: worth installing?

2011-01-18 Thread Cal Leeming [Simplicity Media Ltd]
I would be interested to hear from anyone who has used Pinax in production. Although I am discouraged by the maturity (only 2 years old?), it does seem to contain some useful features. Personally, I would have liked to have seen some of these features merged into the Django core, rather than fork

Re: How to plug in Python: CGI

2011-01-18 Thread Tonton
now it is seems to be mod_wsgi in apache/conf.d/ yoursite.conf WSGIScriptAlias / /path/to/your/djangoproject/wsgi_handler.py WSGIDaemonProcess djangoproject user=CCC group=CCC processes=5 threads=1 WSGIProcessGroup djangoproject and had to write an wsgi_handler in djangoproject r

template tag arithmetic

2011-01-18 Thread GD
Hi everyone, Is there a way to do simple loop counter manipulation within the template? I.e something along the lines of: {% for x in a %} loop number = {{forloop.counter +1}} {% endfor %} with the intention of 2 3 4 as output. I realise the above doesn't work, but is there any

Re: template tag arithmetic

2011-01-18 Thread Thomas
Am 18.01.2011 um 14:53 schrieb GD: > > Hi everyone, > Is there a way to do simple loop counter manipulation within the > template? I.e something along the lines of: > > {% for x in a %} > loop number = {{forloop.counter +1}} > {% endfor %} > > with the intention of > > 2 > 3 > 4 > ..

Re: Pinax: worth installing?

2011-01-18 Thread Javier Guerra Giraldez
On Tue, Jan 18, 2011 at 8:43 AM, Cal Leeming [Simplicity Media Ltd] wrote: > Personally, I would have liked to have seen some of these features merged > into the Django core, rather than forked into a separate project, but that's > just me. AFAICT, it's not a fork, it's a set of apps that you use

Re: Pinax: worth installing?

2011-01-18 Thread Russell Keith-Magee
On Tue, Jan 18, 2011 at 9:43 PM, Cal Leeming [Simplicity Media Ltd] wrote: > I would be interested to hear from anyone who has used Pinax in production. > Although I am discouraged by the maturity (only 2 years old?), it does seem > to contain some useful features. > Personally, I would have liked

Re: Localisation

2011-01-18 Thread David Walker
Thanks Lachlan. The middleware was the bit I was missing. The only mention of it on the Django website appears to be on the Middleware page. Perhaps it should go on the localisation pages? The middleware allows the pages to be localised to the browser's locale, although there are still a number

Re: template tag arithmetic

2011-01-18 Thread Konrad Delong
On 18 January 2011 15:02, Thomas wrote: > > Am 18.01.2011 um 14:53 schrieb GD: > >> >> Hi everyone, >>     Is there a way to do simple loop counter manipulation within the >> template? I.e something along the lines of: >> >> {% for x in a %} >>      loop number = {{forloop.counter +1}} >> {% endfo

Re: Change CSS file in base template depending on browser

2011-01-18 Thread Michel Thadeu Sabchuk
Hi, > I have 2 css files. One specifically for IE because it's so horrible. > I'd like to load either or css files depending on the browser. Why don't you use conditional comments? http://www.quirksmode.org/css/condcom.html Best regards, -- Michel Sabchuk -- You received this message because

Change CSS file in base template depending on browser

2011-01-18 Thread mongoose
Hi there, I have 2 css files. One specifically for IE because it's so horrible. I'd like to load either or css files depending on the browser. I know I have to use agent = request.META['HTTP_USER_AGENT'] I looked at this http://djangosnippets.org/snippets/77/ but it seems complex. All I

Re: Django forms

2011-01-18 Thread Hakim
Thanks man, but I am still suffering from another thing, look at this code: @csrf_exempt @login_required def update_book(request): dontvalidate = request.POST['dontvalidate'] book_id = int(request.POST['book_id']) book = get_object_or_404(Book, id = book_id) if dontvalidate == 'ye

Re: Django forms

2011-01-18 Thread Hakim
Thanks man, the only problem I still have is the following class Book(models.Model): user = models.ForeignKey(User) title = models.CharField(max_length = 100) author= models.CharField(max_length = 100) publisher = models.CharField(max_length = 100) publication_date

Re: template tag arithmetic

2011-01-18 Thread Łukasz Rekucki
On 18 January 2011 15:46, Konrad Delong wrote: > On 18 January 2011 15:02, Thomas wrote: >> >> Am 18.01.2011 um 14:53 schrieb GD: >> >>> >>> Hi everyone, >>>     Is there a way to do simple loop counter manipulation within the >>> template? I.e something along the lines of: >>> >>> {% for x in a

forms, hidden fields

2011-01-18 Thread niall-oc
class VerificationForm(forms.Form): domain = forms.CharField(max_length=100, label='Domain name', help_text='This is the domain name you chose during the signup process', ) mobile_number = forms.CharField(max_length=10,

Re: template tag arithmetic

2011-01-18 Thread niall-oc
http://docs.djangoproject.com/en/dev/ref/templates/builtins/?from=olddocs#add There is loop.counter and loop.counter0. loop.counter starts from 1, and loop.counter0 starts from 0. The 3rd time through a for loop loop.counter is 3 and loop.counter0 is 2. If you want to add things try something li

Re: Change CSS file in base template depending on browser

2011-01-18 Thread Dave Sayer
+1 for conditional comments. They're what all the cool kids are using these days. On 18 Jan 2011 15:00, "Michel Thadeu Sabchuk" wrote: > Hi, > >> I have 2 css files. One specifically for IE because it's so horrible. >> I'd like to load either or css files depending on the browser. > > Why don't yo

Re: Change CSS file in base template depending on browser

2011-01-18 Thread mongoose
Thanks guys. Just saw this in the admin contrib pages too:D win! On Jan 18, 7:36 pm, Dave Sayer wrote: > +1 for conditional comments. They're what all the cool kids are using these > days. > On 18 Jan 2011 15:00, "Michel Thadeu Sabchuk" wrote: > > > Hi, > > >> I have 2 css files. One specificall

Re: forms, hidden fields

2011-01-18 Thread Brian Neal
On Jan 18, 8:32 am, niall-oc wrote: > ... > There is a simple form.  My question is how do you set a field to be > hidden. > > http://docs.djangoproject.com/en/1.1/topics/forms/#looping-over-the-f... > > This document explains how you may check if a field is hidden, however > there seems to be no

Re: 404 view -> redirect to index

2011-01-18 Thread natebeacham
Thomas: That is what he has. Make sure you turn DEBUG off. Your custom 404 handler will only be used when you are not in debug mode. Cheers On Jan 18, 5:10 am, Thomas wrote: > The book "The definitive Guide to Django" says on page 476: > > ---8<--- > > ... if you want to override the 404 view,

Re: How to plug in Python: CGI

2011-01-18 Thread ashdesigner
Ok, thank you, will try to handle it)) On Jan 18, 4:52 pm, Tonton wrote: > now it is seems to be mod_wsgi > > in apache/conf.d/ yoursite.conf > >  WSGIScriptAlias / /path/to/your/djangoproject/wsgi_handler.py > >        WSGIDaemonProcess djangoproject user=CCC group=CCC processes=5 > threads=1 >

Re: Problem with overriding the default Django admin page.

2011-01-18 Thread Jiten Singh
Hi, I am sending my project file details ... Hope this helps *Project Hierarchy* mysite/ |--->/templates/ | |--->/books/(another app like dateapp) | |-->/dateapp/ | | |>*current_datetime.html* | | |>*hours_ahead.html* |

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

2011-01-18 Thread Sithembewena Lloyd Dube
Hi all, I am building a search app. that will query an API. The app. will also store search terms in a very simple table structure. Big question: if the app. eventually hit 10 million searches and I was storing every single search term, would the table hold or would I run into issues? Also, is i

len(qs.all()) != qs.count()

2011-01-18 Thread mack the finger
>>> p=EtilizeProduct.objects.all().using('etilize')[23424] >>> p.productdescription_set.all() [] >>> p.productdescription_set.count() 4 Does anybody have any idea why count() returns 4, but all() returns an empty list? I'm not using any custom routers. >>> str(p.productdescription_set.all().quer

Re: How to plug in Python: CGI

2011-01-18 Thread Graham Dumpleton
On Wednesday, January 19, 2011 12:52:14 AM UTC+11, tonton wrote: > > now it is seems to be mod_wsgi > > in apache/conf.d/ yoursite.conf > > WSGIScriptAlias / /path/to/your/djangoproject/wsgi_handler.py > >WSGIDaemonProcess djangoproject user=CCC group=CCC processes=5 > threads=1 >

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

2011-01-18 Thread Russell Keith-Magee
On Wed, Jan 19, 2011 at 4:04 AM, Sithembewena Lloyd Dube wrote: > Hi all, > > I am building a search app. that will query an API. The app. will also store > search terms in a very simple table structure. > > Big question: if the app. eventually hit 10 million searches and I was > storing every sin

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

2011-01-18 Thread Nick Arnett
On Tue, Jan 18, 2011 at 12:04 PM, Sithembewena Lloyd Dube wrote: > Hi all, > > I am building a search app. that will query an API. The app. will also > store search terms in a very simple table structure. > > Big question: if the app. eventually hit 10 million searches and I was > storing every s

adding fields into another apps forms (in plugin style)

2011-01-18 Thread Michael Buckley
I have been looking at the docs, but so far I can't find anything to help. I am looking to set up some kind of plugin system, so for example I set up my base user registration form, then I might have another app that when added to INSTALLED_APPS automatically adds fields into that form. Been l

Re: Pinax: worth installing?

2011-01-18 Thread Gath
Magee, Wow! Now thats what we call a response. You made me understand this subject more. Thanks a lot Magee. Gath. On Jan 18, 5:32 pm, Russell Keith-Magee wrote: > On Tue, Jan 18, 2011 at 9:43 PM, Cal Leeming [Simplicity Media Ltd] > > wrote: > > I would be interested to hear from anyone who