Re: How to determine whether save() performs update or insert

2008-09-06 Thread varikin
On Sep 4, 2:49 pm, mwebs <[EMAIL PROTECTED]> wrote: > Is there a way to determine whether the model´s save()-method > performs an insert or an update? > > I want to do something like this: > > create modelA_Instance --> create modelB_Instance. > > So my plan is to do this in the save() from modelA

Ordering by ManyToManyField length

2008-09-06 Thread Jarred Bishop
Hello. How would I do this? Say I have a model 'Tag' that has a ManyToManyField called 'entries', can I order a query by total entries? something like this is how I imagine it would work: Tag.objects.all().order_by("entries.count") but I cannot find a proper example. Thanks for your help. --~--

Re: changing code = restarting django??

2008-09-06 Thread James Matthews
Use Fast-Cgi i do touch dispatch.fcgi On Fri, Sep 5, 2008 at 6:12 PM, Graham Dumpleton <[EMAIL PROTECTED] > wrote: > > > > On Sep 6, 2:39 am, Ilya Braude <[EMAIL PROTECTED]> wrote: > > Hernan Olivera wrote: > > >>> In php when you change the code there is no need to restart the > > >>> server, bu

Re: add field to form after post

2008-09-06 Thread todbramble
Yep, that works. Thank you, Paddy. TOD On Sep 6, 9:30 pm, Paddy Joy <[EMAIL PROTECTED]> wrote: > Try it like this: > >                 form_data = request.POST.copy() > >                 form_data['missing_field'] = some_value > >                 submitted_form = SomeForm(form_data) > > Not sur

Re: add field to form after post

2008-09-06 Thread Paddy Joy
Try it like this: form_data = request.POST.copy() form_data['missing_field'] = some_value submitted_form = SomeForm(form_data) Not sure if this is the best approach but it should work. Paddy On Sep 7, 10:48 am, todbramble <[EMAIL PROTECTED]> wr

Re: add field to form after post

2008-09-06 Thread todbramble
I've tried this, which doesn't work: if request.method == 'POST': submitted_form = SomeForm(request.POST) submitted_form.fields['missing_field']=some_value if submitted_form.is_valid(): etc... This returns an AttributeError: ' ' object has no attribute 'widget'. Th

Cache session backend problem?

2008-09-06 Thread Szymon
Hello, I've upgraded today from alpha 2 to 1.0 and get error: Traceback (most recent call last): File "/usr/lib64/python2.5/site-packages/django/core/handlers/ base.py", line 86, in get_response response = callback(request, *callback_args, **callback_kwargs) File "/home/www/django/mwg_pl/

add field to form after post

2008-09-06 Thread todbramble
After a form is submitted how do I add a value to a required attribute before I run form.is_valid()? What I have is: if request.method == 'POST': submitted_form = SomeForm(request.POST) if submitted_form.is_valid(): etc... I want to add the missing fields to the submitted_fo

Middleware Ordering

2008-09-06 Thread kevinski
I count 12 available middleware classes at http://docs.djangoproject.com/en/dev/ref/middleware/, however I can not find a complete listing of the best order to place them. I have read tips here and there about what to do with some of them, but can someone please provide me with the definitive lis

Re: Pyjamas-Desktop and Pyjamas

2008-09-06 Thread lkcl
> words, the code that _was_ handed to the pyjamas compiler is instead > handed to the python compiler. correction: python _interpreter_ :) pyjamas-desktop ends up doing "import pywebkitgtk", which pulls in webkit, which, given that it's a Browser Engine, ends up with *identically* displayed co

Re: interacting django with external programs

2008-09-06 Thread Ned Batchelder
You're right: making a crontab entry for each user's needs would be cumbersome. But if you have a reasonable minimum interval (say 10 minutes), then write one cronjob that looks for all of the user's jobs that need to be run. Then you have one crontab entry, and the rest of the work is in yo

Pyjamas-Desktop and Pyjamas

2008-09-06 Thread lkcl
folks, hi, as an instant django convert when i discovered it a couple of months ago, i wanted to make people aware of some technology that has saved me vast amounts of development effort, and given me no end of amusement: pyjamas. pyjamas - http://code.google.com/p/pyjamas - is an AJAX-based web

interacting django with external programs

2008-09-06 Thread David
Hey'a I have a newbie question. I want to execute an external (lets say python, but can be any) program given a interval set by a user (which would be in the user table). The external program would update the sql database. I thought of doing this with a cronjob but as they may be a number of use

Re: Forms across multiple pages?

2008-09-06 Thread [EMAIL PROTECTED]
This might help: http://www.djangoproject.com/documentation/form_wizard/ Or you could write the views your self and track the user's place in the form series with a session variable. -Justin On Sep 6, 8:16 am, MikeHowarth <[EMAIL PROTECTED]> wrote: > Can't seem to find anything of relevance in

Re: Sessions and IP Addresses

2008-09-06 Thread Tim Chase
>>> NAT (I believe AOL did/does something like this) so requests from >>> the same user behind the NAT can appear to be coming from >>> different public IP addresses. >> >> AOL certainly does this. Either that or my own little web site has an >> astonishingly high number of different AOL users hi

MySQLdb + AMD64

2008-09-06 Thread TheIvIaxx
After searching around for a bit for a build of MySQLdb, i have found that i will probably need to build the module for AMD64 on windows. Is there a guide or something that shows what needs to be done to build a module for a certain architecture? Thanks --~--~-~--~~~-

How to get children models

2008-09-06 Thread Seamus
Simply, how do I get a list of models which are children of a model? children = get_children_models(BaseModel) I have look through ContentTypes and properties on the generated models with no luck. Thanks in advance. --~--~-~--~~~---~--~~ You received this messag

Re: How does django know the difference between INSERT and UPDATE

2008-09-06 Thread jonknee
> I read that Django knows the difference between a new and a updated record, > but it replicates the customer if I don't set the customer_id before a > customer.save. Would somebody please shoot at my code and tell me where the > room for improvement is hiding? You're almost there, just make

ORM vs SQL vs HBase

2008-09-06 Thread Posi
Still though, how tied are we to a true relational model and how does that tie to a column based DB. --~--~-~--~~~---~--~~ 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

Re: form_for_instance

2008-09-06 Thread David
oops, should be. pForm = PersonForm(instance=p) On Sep 6, 5:14 pm, David <[EMAIL PROTECTED]> wrote: > nm i figured it out. > > class PersonForm(ModelForm): >     class Meta: >           model = Person > > def person_form(request, pID='0'): >     p = get_object_or_404(Person,pk=pID) > #    P

Re: form_for_instance

2008-09-06 Thread David
nm i figured it out. class PersonForm(ModelForm): class Meta: model = Person def person_form(request, pID='0'): p = get_object_or_404(Person,pk=pID) #PersonForm = forms.ModelForm() pForm = PersonForm() On Sep 6, 5:03 pm, David <[EMAIL PROTECTED]> wrote: > Hi, > > newf

form_for_instance

2008-09-06 Thread David
Hi, newforms and form_for_instance have been removed How would I write the following using the new notation I have replaced from django import newforms as forms with from django import forms but unsure as to what to do with the following def person_form(request, pID="0") p = get_object_o

get_profile() generates a huge amount of queries

2008-09-06 Thread Sylvain
Hi everybody, Today I wanted to add an "avatar" feature to my app, so I created a user profile and put a "get_avatar" method which retrieves the Punbb avatar of the user. Now I'm able to display the users' avatars next to their usernames in their comments, which is nice. What is not nice is that

Re: Sessions and IP Addresses

2008-09-06 Thread Karl Ward
On Sep 6, 1:32 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Sat, Sep 6, 2008 at 8:20 AM, Tim Chase <[EMAIL PROTECTED]>wrote: > > > Or one might be behind a load-balancing > > NAT (I believe AOL did/does something like this) so requests from > > the same user behind the NAT can appear to be

Re: Practical Django Projects: Coltrane's entry detail not working

2008-09-06 Thread phred78
Thanks Karen, I missed 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-users@googlegroups.com To unsubscribe from this group, send email to

cannot log a user in right after creating them :/

2008-09-06 Thread vbgunz
here is a better version of the code below while it still lasts: http://dpaste.com/76325/ # the illest issue is right after the except clause. New accounts should be # logged in right after creation BUT the new account cannot immediately log # in. Whats the issue? def create(request): ''' crea

Re: Sessions and IP Addresses

2008-09-06 Thread Karen Tracey
On Sat, Sep 6, 2008 at 8:20 AM, Tim Chase <[EMAIL PROTECTED]>wrote: > Or one might be behind a load-balancing > NAT (I believe AOL did/does something like this) so requests from > the same user behind the NAT can appear to be coming from > different public IP addresses. > > AOL certainly does this

Re: Sessions and IP Addresses

2008-09-06 Thread Tim Chase
> The question is this: what does Django do when multiple > requests come in from different IP addresses that are > reporting the same session id? Does Django dump the session > data and create new session ids for the offending clients? I believe the answer is "Django does the right thing", i.e.

Forms across multiple pages?

2008-09-06 Thread MikeHowarth
Can't seem to find anything of relevance in the docs, so wondering if someone could help me. Basically I want to put an email signup form in the footer of my site, which I can display errors/success message in place. Other than using Ajax to post this info in the background is there a way in Dja

Sessions and IP Addresses

2008-09-06 Thread Karl Ward
Hi, I have a question about Django's built-in session support. I've looked around in the documentation (and the free Django on-line book) but couldn't find an answer. Its the sort of question that could be answered by a look through the code, but I'm new to Python and at the moment just trying to

Re: handling database restarts

2008-09-06 Thread msoulier
On Sep 3, 3:44 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote: > Hi Mike, > > Assuming that the DB restarts are rare, consider surrounding your > processing loop with a try..except block. When the exception occurs, > close the current connection so that the next iteration of your loop > gets a fresh

Django on jython install problem

2008-09-06 Thread tk.saddle
Hi, I want to install django on jython at windows xp. When I setup django with jython2.5a, I saw following traceback message. C:\Django-1.0-beta_2>c:\jython2.5a1_2\jython setup.py install Traceback (most recent call last): File "setup.py", line 3, in from distutils.command.install import I

Re: apache mysql problem

2008-09-06 Thread Graham Dumpleton
PeteDK wrote: > Hi everybody... > > I am trying to setup my apache webserver on a CentOS machine. I'm > almost there(i hope) > > however i keep getting a weird error message. Weird in the sense that > i can easily connect to the same mysqldb when using the local > development server but not when

Re: DateTimeFields not showing up in Admin page

2008-09-06 Thread Guillermo
I was using the "auto_now" and "auto_now_add" options. That seems to be the cause and to my knowledge there's no way to override this. Regards, Guillermo On Sep 6, 10:17 am, Guillermo <[EMAIL PROTECTED]> wrote: > Hi! > > I have this model with two `DateTimeField`s that aren't showing up in > t

Re: .get_x/.get_y works in python but not in template

2008-09-06 Thread Ben Eliott
Lol, it worked the last time. I'll try and extract some debugging info. On 5 Sep 2008, at 22:19, bruno desthuilliers wrote: > > On 5 sep, 18:05, "[EMAIL PROTECTED]" > <[EMAIL PROTECTED]> wrote: >> This is odd, but probably something obvious i'm screwing up. I have a >> point field 'office_coordi

foreign key exception where objects manager is customized

2008-09-06 Thread [EMAIL PROTECTED]
A foreignkey in a model with a customised objects manager is causing an exception when that parent model is saved. Model 'SuperDelegate' has a boolean field 'is_active'. 'Delegate' model has a ForeignKey to SuperDelegate. I only want to ever show active SuperDelegates so the objects manager has t

Re: Deployment help needed Django + Interchange

2008-09-06 Thread Graham Dumpleton
What are the rewrite rules used to push through stuff to Interchange? Are these before or after the rewrite fules related to mod_python and where does the Location directive sit relative to that. In other words, provide the complete Apache configuration sections pertaining to both. Graham On Se

How does django know the difference between INSERT and UPDATE

2008-09-06 Thread Gerard Petersen
Hi all, I read that Django knows the difference between a new and a updated record, but it replicates the customer if I don't set the customer_id before a customer.save. Would somebody please shoot at my code and tell me where the room for improvement is hiding? def customer_edit(request, cus

DateTimeFields not showing up in Admin page

2008-09-06 Thread Guillermo
Hi! I have this model with two `DateTimeField`s that aren't showing up in the Admin page. According to the documentation, the default value for `editable` is "True". I can't figure out what I'm missing... (I'm using version 1.0.) Here's the relevant admin.py code: class PostAdmin(admin.ModelA

Re: Deployment help needed Django + Interchange

2008-09-06 Thread macgregor
Yes, I've read it. Django is running on Apache/mod_python on my server, it's the running side-by-side with another application server (Interchange) in my case that I'm having trouble with. Here is how I have it set up: SetHandler python-program PythonHandler django.core.handlers

Re: ContentTypes Framework and generic relations : no index on object_id ?

2008-09-06 Thread Sylvain
Hi Bruno, first of all thanks for your anser. On 6 sep, 01:13, bruno desthuilliers <[EMAIL PROTECTED]> wrote: > On 5 sep, 23:52, Sylvain <[EMAIL PROTECTED]> wrote: > > > Hi everybody, > > > Today I was hunting down some serious performance problems in my app > > and I found something pretty "conf

apache mysql problem

2008-09-06 Thread PeteDK
Hi everybody... I am trying to setup my apache webserver on a CentOS machine. I'm almost there(i hope) however i keep getting a weird error message. Weird in the sense that i can easily connect to the same mysqldb when using the local development server but not when using apache. PythonHandler

Re: How to subclass a model class?

2008-09-06 Thread Alex Chun
Thanks, Bruno. I will try that first thing Monday. Thanks for helping this newbie out!! On Sep 5, 5:50 pm, bruno desthuilliers <[EMAIL PROTECTED]> wrote: > On 6 sep, 02:19, Alex Chun <[EMAIL PROTECTED]> wrote: > > > Thank you for the response.  I should have said: the subclass is not > > part o

python templating languages and django

2008-09-06 Thread Brendan
Hi, I'm looking at various python web frameworks, primarily looking for something to handle the presentation layer right now, and I heard some things about django. I looked at django's templating langauge and some other python templating languages. I'm most familiar with XML based templating lang