Count foreignkey(self)

2007-03-16 Thread [EMAIL PROTECTED]
If I have a model with something like class A (models.model): parent = meta.ForeignKey('self', blank=True, null=True, related_name='child') Is it possible to do a select for some results in A along with a count of all their children? -Dougal

Re: newb: newforms and passing an extra parameter: forms.SalesForm(request.POST, p_id)

2007-03-16 Thread dballanc
Maybe I'm misunderstanding ,but if you just need to validate why give your form a custom clean() method to take the p_id parameter and verify with self.clean_data? If you have to pass it in on creation, this is what I did when I extended extended the form class to handle a bunch of OneToOneField

Re: Wiki account

2007-03-16 Thread Kenneth Gonsalves
On 17-Mar-07, at 7:05 AM, Kenneth Gonsalves wrote: >> figure out >> how to create an account, so I had to do it anonymously. > > edit preferences so your email address is recognised and appears - > good enough for all purposes oops - s/preferences/settings/ -- regards kg

Re: backup/restore DB data...

2007-03-16 Thread Russell Keith-Magee
On 3/17/07, Michael <[EMAIL PROTECTED]> wrote: > > > You can try db_dump.py tool, it's not a web-gui based, but a command line > tool. > > > > http://www.djangosnippets.org/snippets/14/ > > > > It is a very good tool to work with Mysql or sqlite3 but not with > Postgresql. An alternative is to

Re: Wiki account

2007-03-16 Thread Kenneth Gonsalves
On 17-Mar-07, at 2:45 AM, Todd O'Bryan wrote: > I just edited a Wiki page and maybe I'm dense, but I couldn't > figure out > how to create an account, so I had to do it anonymously. edit preferences so your email address is recognised and appears - good enough for all purposes --

Re: newb: newforms and passing an extra parameter: forms.SalesForm(request.POST, p_id)

2007-03-16 Thread johnny
>self.data.get('p_id') I tried it, getting error: Exception Type: AttributeError Exception Value: 'str' object has no attribute 'get' --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users"

Re: backup/restore DB data...

2007-03-16 Thread limodou
On 3/16/07, Jens Diemer <[EMAIL PROTECTED]> wrote: > > limodou schrieb: > > You can try db_dump.py tool, it's not a web-gui based, but a command line > > tool. > > > > http://www.djangosnippets.org/snippets/14/ > > Very cool! It seems to work without problems ;) > > I made a hack to put it into

Re: backup/restore DB data...

2007-03-16 Thread limodou
On 3/17/07, Michael <[EMAIL PROTECTED]> wrote: > > > On 3/17/07, limodou <[EMAIL PROTECTED] > wrote: > > > > On 3/16/07, Jens Diemer <[EMAIL PROTECTED]> wrote: > > > > > > > > > I would like to backup and restore my django App-Database. This should > > > be usable with a Web-GUI. > > > I thought

Re: newb: newforms and passing an extra parameter: forms.SalesForm(request.POST, p_id)

2007-03-16 Thread Brian Rosner
On 2007-03-16 13:51:17 -0600, "johnny" <[EMAIL PROTECTED]> said: > > I have a forms.py that uses newforms. It has a class > SalesForm(forms.Form). I need to pass an argument, p_id to SalesForm, > which is used to retrieve related product from product model. When I > run it, I get an error: >

Re: newb: newforms and passing an extra parameter: forms.SalesForm(request.POST, p_id)

2007-03-16 Thread Rubic
On Mar 16, 4:49 pm, "johnny" <[EMAIL PROTECTED]> wrote: > Now within SalesForm, how do I get p_id? self.data.get('p_id') -- Jeff Bauer Rubicon, Inc. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django

Re: newb: newforms and passing an extra parameter: forms.SalesForm(request.POST, p_id)

2007-03-16 Thread johnny
I need to validate the data user enters, based on the product they have viewed. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Playing with fixtures and django serializers -> Errors...

2007-03-16 Thread Russell Keith-Magee
On 3/16/07, Jens Diemer <[EMAIL PROTECTED]> wrote: > > Generally: I have possibly wrong data in the data base. But i think > django does not help, to find these wrong data. > I made "django-admin dumpdata" and i got this error: > """ > Unable to serialize database: ContentType matching query does

Re: Preventing Multiple Logins

2007-03-16 Thread Julio Nobrega
I did it using PHP. It can be circumvented but it's not something the average user would do. Everytime an user logins, the session id is stored on a table, with the time and the user id. On every request by every logged in user, I put every previous session ids from the user id on an array,

Re: Preventing Multiple Logins

2007-03-16 Thread Tim Chase
> I would like to find a way to prevent users from simultaniously > logging in from different computers but using the same username and > password. How do you define "different computers"? A remote IP address, possibly cookies, and possibly JavaScript are about all you have to work with to

Re: Preventing Multiple Logins

2007-03-16 Thread Rubic
The quick answer would be to check through the session data for a matching user id, but there's one possible wrinkle: How do you know when a user has logged off? In my case (not yet implemented), I'll have a timeout, but that still doesn't address the issue of a user losing a connection and

Re: newb: newforms and passing an extra parameter: forms.SalesForm(request.POST, p_id)

2007-03-16 Thread johnny
I did this: forms.SalesForm(request.POST, p_id). Inside class SalesForm(forms.Form) which init was overwrote, as you mentioned like below. Now within SalesForm, how do I get p_id? > class SalesForm(forms.Form): > def __init__(self, *args, **kwargs): > super(SalesForm,

Preventing Multiple Logins

2007-03-16 Thread cwurld
Hi, In order for users to use my Django site they must login. I am using the standard auth app. I set the session to expire when the browser is closed or when the user clicks a log out button. I would like to find a way to prevent users from simultaniously logging in from different computers

Re: Wiki account

2007-03-16 Thread James Bennett
On 3/16/07, Todd O'Bryan <[EMAIL PROTECTED]> wrote: > I just edited a Wiki page and maybe I'm dense, but I couldn't figure out > how to create an account, so I had to do it anonymously. You should be able to get Tract to remember you by clicking the "settings" link right above the nav bar and

Re: Wiki account

2007-03-16 Thread Malcolm Tredinnick
On Fri, 2007-03-16 at 17:15 -0400, Todd O'Bryan wrote: > I just edited a Wiki page and maybe I'm dense, but I couldn't figure out > how to create an account, so I had to do it anonymously. It's a little hidden, I would agree. I considered it a real find when I worked out how to do this when I

Re: Newforms: Is the current method of multiple field comparison the best way?

2007-03-16 Thread Ian
> super(ConfirmForm2,self).__init__(*args,**kwargs) Copy paste edit: ConfirmForm, not with the 2. :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

Re: Newforms: Is the current method of multiple field comparison the best way?

2007-03-16 Thread Ian
Here's another brainstorm that's sort of a combination. :) It's a Form that handles confirmation validation, but does so at the field level. Code will help illuminate what I mean: class ConfirmForm(forms.Form): """ ... """ def __init__(self, *args, **kwargs):

Wiki account

2007-03-16 Thread Todd O'Bryan
I just edited a Wiki page and maybe I'm dense, but I couldn't figure out how to create an account, so I had to do it anonymously. Is there a way to get a Trac account or are those reserved for the nobility? Todd --~--~-~--~~~---~--~~ You received this message

Re: validating using newforms

2007-03-16 Thread Rubic
I don't work much with form_for_model, but you could probably do something like this: IconForm = forms.models.form_for_model(Icon) if request.method == 'POST': form = IconForm(request.POST) Then perform your own validation, assigning an error to the field and returning: context =

Re: newb: newforms and passing an extra parameter: forms.SalesForm(request.POST, p_id)

2007-03-16 Thread Rubic
johnny, Place p_id as a field in the template (it can be a hidden) so you don't need to pass it as a parameter to SalesForm. If you still need to override the __init__ method in SalesForm, do it in the following manner: class SalesForm(forms.Form): def __init__(self, *args, **kwargs):

Re: backup/restore DB data...

2007-03-16 Thread Michael
On 3/17/07, limodou <[EMAIL PROTECTED]> wrote: > > > On 3/16/07, Jens Diemer <[EMAIL PROTECTED]> wrote: > > > > > > I would like to backup and restore my django App-Database. This should > > be usable with a Web-GUI. > > I thought fixtures would be well usable for it. But there are some > >

Re: Newforms: Is the current method of multiple field comparison the best way?

2007-03-16 Thread Ian
James, > While I can understand feeling frustrated at writing custom validation > methods, To clarify, I only feel frustrated at writing custom code for ubiquitous validation needs. > And that distinction -- between Field-level validation and Form-level > validation -- also makes intuitive

Re: Newforms: Is the current method of multiple field comparison the best way?

2007-03-16 Thread Rubic
On Mar 16, 2:18 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > And that distinction -- between Field-level > validation and Form-level validation -- also > makes intuitive sense to me; it feels right > that a Field only needs to know about itself, I'm not particularly concerned about field

Re: newb: newforms and passing an extra parameter: forms.SalesForm(request.POST, p_id)

2007-03-16 Thread ibonso
Hi, I don't understand very well what you are trying, but the error is clear: class SalesForm(forms.Form): def __init__(self, p_id): do some stuff here SalesForm constructor only expect one parameter plus the object itself (self). You are passing request.POST, and that

newb: newforms and passing an extra parameter: forms.SalesForm(request.POST, p_id)

2007-03-16 Thread johnny
I have a forms.py that uses newforms. It has a class SalesForm(forms.Form). I need to pass an argument, p_id to SalesForm, which is used to retrieve related product from product model. When I run it, I get an error: Exception Type: TypeError Exception Value:__init__() takes

Re: model relationship filtering

2007-03-16 Thread Laurie Harper
[EMAIL PROTECTED] wrote: > Hello, > > I have a site that offers a bunch of appartments for rent. Each of > these rentals has a image gallery showing the look of that place. > My models currently look like this: > > class Photo( models.Model ): > name = models.ImageField( upload_to='rentals'

Re: Related foreign fields in admin application

2007-03-16 Thread Laurie Harper
Atilla wrote: > ... If you're using the newforms admin ... Is there one? The code in django/contrib/admin looks like it's using oldforms to me. If there's a version based on newforms somewhere I'd love to take a look :-) L. --~--~-~--~~~---~--~~ You received

Re: newforms with no pre-set number of fields

2007-03-16 Thread Joseph Kocherhans
On 3/16/07, Todd O'Bryan <[EMAIL PROTECTED]> wrote: > > On Fri, 2007-03-16 at 17:41 +, Rubic wrote: > > Just use a ChoiceField with a radio or checkbox widget. > > > > http://www.djangosnippets.org/snippets/26/ > > > > -- > > Jeff Bauer > > Rubicon, Inc. > > Sorry, wasn't clear. I know how

Newforms: Is the current method of multiple field comparison the best way?

2007-03-16 Thread Ian
The purpose of web development frameworks is to make common web development tasks easier, or give them to you for free. A forms framework which requires custom code for password comparisons does not satisfy this fundamental requirement. I've seen the test codes that tell you how to compare

Re: newforms with no pre-set number of fields

2007-03-16 Thread Rubic
Just use a ChoiceField with a radio or checkbox widget. http://www.djangosnippets.org/snippets/26/ -- Jeff Bauer Rubicon, Inc. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to

newb: Newform conditional regexField

2007-03-16 Thread johnny
In newform, how do I allow a single regexField to accept either a whole number, or number with decimal places? Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: postgesql commit problem?

2007-03-16 Thread Joseph Heck
Try: transaction.commit_unless_managed() I originally found it in the django scripts code ( http://code.djangoproject.com/browser/django/trunk/django/bin/daily_cleanup.py), and it forces a commit when you're not under transaction management. I never found any references to it in the

Re: tryin edit a user in DJANGO ADMIN and get 404

2007-03-16 Thread RajeshD
> Hi all. I try to edit user in DJANGO ADMIN, I can see user list but > when I click on one of them I get Page not found (404). What URL does your browser show when you get that 404 error? --~--~-~--~~~---~--~~ You received this message because you are

Re: Connection reset by peer error on POST content longer than about 6k chars...

2007-03-16 Thread Joseph Heck
The django development server isn't multithreaded by default, and it's probably having some trouble serving back the files. There were some hacks/mods on this last a few months back talking about how to change the dev server so that it was multithreaded and make it a tad more reliable. I'm afraid

newforms with no pre-set number of fields

2007-03-16 Thread Todd O'Bryan
I'm trying to design a form for multiple choice questions: Question: Answer A: Answer B: Answer C: Correct Answer: A B C... Explanation: The problem is that I don't want to fix the number of possible answers so

Re: newb: Newform conditional regexField

2007-03-16 Thread John Lenton
On 3/16/07, johnny <[EMAIL PROTECTED]> wrote: > > In newform, how do I allow a single regexField to accept either a > whole number, or number with decimal places? doesn't r"\d+(\.\d*)?" work? -- John Lenton ([EMAIL PROTECTED]) -- Random fortune: The trouble with a lot of self-made men is that

Re: Outputting a default value for my TextField custom form manipulator html input ...

2007-03-16 Thread dbee
Thanks Benedict. I just figured out a way to do what I wanted, and I thought I'd update this thread for completion. If you pass a dict to the form wrapper with the form field results, the FormWrapper will parse the results in as default values ... new_data = {

Antonio Cangiano asks for input to develop a DB2 backend for Django (and Python)

2007-03-16 Thread Lawrence Oluyede
Antonio Cangiano is the author of the IBM DB2 tools for Rails and his team and him are going to do the same for Django and Python. Right now he's asking for help to collect ideas to do a proper job. I think it's great having this kind of support for Python and Django. Here's the blog post:

Re: backup/restore DB data...

2007-03-16 Thread Jens Diemer
limodou schrieb: > You can try db_dump.py tool, it's not a web-gui based, but a command line > tool. > > http://www.djangosnippets.org/snippets/14/ Very cool! It seems to work without problems ;) I made a hack to put it into my web install section:

Re: update_object and duplication of inline objects on save

2007-03-16 Thread martwine
Hi, I have the same or similar problem. I'm using update_object to reproduce the inline editing of a foreignkey join table that works very well in the admin interface. When editing a publication, I need to be able to add authors to the publication, who are linked to publications by an explicit

Re: Outputting a default value for my TextField custom form manipulator html input ...

2007-03-16 Thread Benedict Verheyen
dbee schreef: > I'm trying to output an account form, with the user's values already > in place. So that if they wish to change any value, they can just > change the > I'm using .95 with oldforms, and I can't seem to find anyway of > outputting a default value with my form. That's a serious

Re: validating using newforms

2007-03-16 Thread Benedict Verheyen
Rubic schreef: > Benedict, > > You add a clean_XXX method to your form class, > where XXX corresponds to the field name you wish > to validate. > > In your clean_XXX method, you return > self.clean_data['XXX'] if your data validates, > otherwise raise a ValidationError exception. > > I just

Re: backup/restore DB data...

2007-03-16 Thread limodou
On 3/16/07, Jens Diemer <[EMAIL PROTECTED]> wrote: > > > I would like to backup and restore my django App-Database. This should > be usable with a Web-GUI. > I thought fixtures would be well usable for it. But there are some > problems with this. Look at: >

Re: validating using newforms

2007-03-16 Thread Rubic
Benedict, You add a clean_XXX method to your form class, where XXX corresponds to the field name you wish to validate. In your clean_XXX method, you return self.clean_data['XXX'] if your data validates, otherwise raise a ValidationError exception. I just posted a similar response on this

Outputting a default value for my TextField custom form manipulator html input ...

2007-03-16 Thread dbee
I'm trying to output an account form, with the user's values already in place. So that if they wish to change any value, they can just change the http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---

backup/restore DB data...

2007-03-16 Thread Jens Diemer
I would like to backup and restore my django App-Database. This should be usable with a Web-GUI. I thought fixtures would be well usable for it. But there are some problems with this. Look at: http://groups.google.com/group/django-users/browse_thread/thread/6a4e9781d08ae815 What is a

Re: Portuguese (pt) request.LANGUAGE_CODE problem

2007-03-16 Thread Nuno Mariz
You can download now the unofficial Portuguese(pt_PT) translation of Django in http://mariz.org/downloads/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Django Tutorial

2007-03-16 Thread Ramiro Morales
On 3/15/07, Paul Rauch <[EMAIL PROTECTED]> wrote: > > Malcolm Tredinnick schrieb: > > On Thu, 2007-03-15 at 19:22 +0100, Paul Rauch wrote: > >> -BEGIN PGP SIGNED MESSAGE- > >> Hash: SHA1 > >> > >> Hello, > >> > >> I use django with python 2.5. > >> I already got the same error during

Re: Newforms - Dynamic Fields from a queryset

2007-03-16 Thread Tipan
> > >> number_of_meds = kwargs.pop('number_of_meds', 4) > > This is how I optionally passed the number of > fields I wanted to display in the form. If there's > no 'number_of_meds' in kwargs, a minimum of 4 fields > are displayed. The trick is to use kwargs.pop() before > super is called, or

Re: user, signal & _thread_locals

2007-03-16 Thread sandro.dentella
> > I realize now that signal do not preserve it (I guess that are run in a > > different thread, correct?) > > What do you mean by "preserve it"? A signal dispatch is just a series of > function calls. They happen in the same thread as whatever does the > dispatch. I mean that I find the

Re: django.template.TemplateSyntaxError: Invalid block tag: 'extends'

2007-03-16 Thread Michael Cuddy
> If i don't import the loader i get the error: Amazing you should post this ... I was just about to do the same! (I just ran across this error tonight, and was typing up a message to the list) -- Mike Cuddy ([EMAIL PROTECTED]), Programmer, Baritone, Daddy, Human. Fen's Ende Software, Redwood

django.template.TemplateSyntaxError: Invalid block tag: 'extends'

2007-03-16 Thread Jens Diemer
I used a base.html template and extends it with a String-Template. Example: -- from django.template import Template, Context #, loader my_example_string_template = """ {% extends "example.html" %} blabla... """ c = Context(context) t =

Re: Transfer-Encoding: chunked =? Content-Length

2007-03-16 Thread [EMAIL PROTECTED]
I'm running into this exact scenario and haven't been able to confirm that checked encoding is officially supported by XML-RPC but the request is there nonetheless. Does anyone know of a python solution that will handle chunked encoding calls properly? PS: You work at RSTL perhaps? On Mar 2,

model relationship filtering

2007-03-16 Thread [EMAIL PROTECTED]
Hello, I have a site that offers a bunch of appartments for rent. Each of these rentals has a image gallery showing the look of that place. My models currently look like this: class Photo( models.Model ): name = models.ImageField( upload_to='rentals' ) class Rental( model.Model ):