Re: OR lookups

2008-02-10 Thread Malcolm Tredinnick
On Sun, 2008-02-10 at 23:14 -0800, Julien wrote: > Hi there, > > I'd like to pull out all the projects that a given user is involved > in, either as a creator or as a participant of the projects: > > class Project(models.Model): > name = models.CharField(max_length=200) > created_by = m

OR lookups

2008-02-10 Thread Julien
Hi there, I'd like to pull out all the projects that a given user is involved in, either as a creator or as a participant of the projects: class Project(models.Model): name = models.CharField(max_length=200) created_by = models.ForeignKey(User) class Participant(models.Model): proje

Re: newforms validator_list

2008-02-10 Thread Daniel
> Not sure about trunk but in newforms-admin at least you can just > subclass your model field and overwrite formfield() to get the admin > to use another form field. That way you can declare a custom form > field (or just a standard one like RegexField) to tweak your > validation for the forms ge

Re: hosting web

2008-02-10 Thread Ramdas S
If you are moving an application which is production ready and hosting it in dreamhost, then its no issue. However, if you need to constantly tinker around with it, that is make changes, add features etc, you will need to keep on starting FastCGI processes, that gets killed by sys admins, during t

Re: Database fields not showing up as unicode

2008-02-10 Thread Dave Dash
Malcolm, It looks like i just found my solution: http://automatthias.wordpress.com/2006/12/10/mysql-encoding-problems-on-dreamhost/ Apparently all the fields were encoded incorrectly. On Feb 10, 9:44 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Sun, 2008-02-10 at 21:11 -0800, Dave Da

Re: Database fields not showing up as unicode

2008-02-10 Thread Malcolm Tredinnick
On Sun, 2008-02-10 at 21:11 -0800, Dave Dash wrote: > Hi, > I have a legacy database that I've been using in a php app. In PHP > the fields would render as unicode just fine. There are a lot of variables involved here, so before we go any further, please provide some more information:

newforms-admin inlines question

2008-02-10 Thread Aaron Fay
Hi List, I am using newforms admin and have a custom UserProfile model set in my inlines for my User, is there a way to limit the UserProfile to 1 for the User? Right now it's trying to offer 4 profiles for the user, and 'extras=1' doesn't seem to affect how many are displayed (I don't want

Database fields not showing up as unicode

2008-02-10 Thread Dave Dash
Hi, I have a legacy database that I've been using in a php app. In PHP the fields would render as unicode just fine. In my Django app I get: PhamâEURO(tm)s instead of the expected: Pham's This happens for accented characters everything. I'm no good with unicode, it has usually "just worked"

Re: translation trouble: gettext-error

2008-02-10 Thread Malcolm Tredinnick
On Thu, 2008-01-31 at 07:47 -0800, patrickk wrote: > when typing "/bin/make-messages.py -l de" from within my app- > directory, I get this error: > > errors happened while running xgettext on __init__.py > /bin/sh: line 1: xgettext: command not found > > "which gettext" tells me that gettext is

Re: reason to limit choices actual-value length?

2008-02-10 Thread Malcolm Tredinnick
On Mon, 2008-02-04 at 11:22 -0800, [EMAIL PROTECTED] wrote: > I'm talking about this kind of choices field > http://www.djangoproject.com/documentation/model-api/#choices > > e.g. > class Foo(models.Model): > GENDER_CHOICES = ( > ('M', 'Male'), > ('F', 'Female'), > ) >

Re: OneToOne Relationships

2008-02-10 Thread Malcolm Tredinnick
On Wed, 2008-02-06 at 11:59 -0800, Vance Dubberly wrote: > Thanks that makes more sense than the current implementation. I hope > that using ForeignKey for the current relationships now will allow me > to update the with unique=True later ( of course realizing that I'll > have to play with how I

Re: query.filter(some_foreignKey_field__exact=None)

2008-02-10 Thread Malcolm Tredinnick
On Thu, 2008-02-07 at 13:06 -0800, [EMAIL PROTECTED] wrote: > Thanks for pointing out isnull()! > > I did try with None and 'None'... For part_of=None, both .filter() > and .exclude() return empty sets, which could signal to a newbie that > somethings wrong with the approach. At the moment, f

Re: Using a filter with many to many relationship

2008-02-10 Thread ecir hana
On Feb 11, 2008 12:02 AM, Tim Chase <[EMAIL PROTECTED]> wrote: > >>offers = Offer.objects.all() > >>for term in ('ThemePark', 'London'): > >> offers = offers.extra(where=[""" > >>EXISTS ( > >> SELECT 0 > >> FROM app_offer_term ot > >>ON o.id = ot.

Re: Using a filter with many to many relationship

2008-02-10 Thread Tim Chase
>>offers = Offer.objects.all() >>for term in ('ThemePark', 'London'): >> offers = offers.extra(where=[""" >>EXISTS ( >> SELECT 0 >> FROM app_offer_term ot >>ON o.id = ot.offer_id >>INNER JOIN app_term t >>ON ot.term_id = t.

Re: How to create a global value?

2008-02-10 Thread [EMAIL PROTECTED]
No, a session is exactly how you would do something like that. On Feb 10, 4:26 pm, Greg <[EMAIL PROTECTED]> wrote: > Hello, > I have a view that does some logic. Based on the result of that logic > I want to set a variable to True or False. I want to be able to > access this variable in a diffe

How to create a global value?

2008-02-10 Thread Greg
Hello, I have a view that does some logic. Based on the result of that logic I want to set a variable to True or False. I want to be able to access this variable in a different view. I know that I can create a new session variable and assign either True or False to it. However, it there an eas

Re: Web Development with Django: Windows vs Linux/Mac OS X

2008-02-10 Thread Oscar Carlsson
Another cool editor is Scribes ( http://scribes.sourceforge.net/ ), at least last time I tried it. Might take some configuring, but it might be worth it :) On Sun, Feb 10, 2008 at 10:12:02PM +0530, Ramdas S wrote: > I know its no replacement, but try scite editor. Its cool and is used by > many py

Re: hosting web

2008-02-10 Thread Alexey Moskvin
Ramadas, I want to run my django website (it is not highload, about 1000 visitors per day) on Dreamhost. I have no problems with running up Django there, but now I moved all development to local machine (according to high latency when working with DH using ssh). But I want to move my app there, wh

Re: The best practice for a registration and then getting user to fill up extra information

2008-02-10 Thread Prairie Dogg
Just thought I'd add that I went through the exact same thing, spent a couple hours integrating django-registration only to find django- profiles later, gotta say that the little google maps locator in django-profiles is really nifty. I've had to make some modifications to django-profiles to corr

Re: Not using Django's built in auth, getting errors on 404s

2008-02-10 Thread Hugh Bien
Thanks Malcom, I didn't know that context_processors.auth was one of the defaults for TEMPLATE_CONTEXT_PROCESSOR. I went ahead and defined that to be the defaults from django.conf.global_settings minus the django.core.context_processors.auth. Everything seems to be working smoothly. On Feb 10

Re: [error] 'str' object has no attribute 'creation_counter'

2008-02-10 Thread Prof. William Battersea
Thank you, that's very clear now. I completely forgot those were querysets. Thank you for your time. WB On Feb 10, 2008 10:48 AM, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > > On Sun, 2008-02-10 at 10:33 -0500, Prof. William Battersea wrote: > [...] > > > > I had a Model called Gallery, wh

Re: Web Development with Django: Windows vs Linux/Mac OS X

2008-02-10 Thread Ramdas S
I know its no replacement, but try scite editor. Its cool and is used by many python developers I know. Also check these http://wiki.python.org/moin/PythonEditors RS On Feb 10, 2008 9:01 PM, NickJ <[EMAIL PROTECTED]> wrote: > > I am a long time windows user, and have just switched to ubuntu gut

Re: [error] 'str' object has no attribute 'creation_counter'

2008-02-10 Thread Malcolm Tredinnick
On Sun, 2008-02-10 at 10:33 -0500, Prof. William Battersea wrote: [...] > > I had a Model called Gallery, which had a ManyToManyField pointing to > a Model called Location. In location, I had set my __str__ method to: > > return " / ".join(str(v) for v in self.location if not v == "") There ar

Re: [error] 'str' object has no attribute 'creation_counter'

2008-02-10 Thread Prof. William Battersea
On Feb 10, 2008 9:50 AM, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > > On Sun, 2008-02-10 at 09:27 -0500, Prof. William Battersea wrote: > > Hello, > > > > I created a Django application, validated it for errors and ran syncdb > > without any problems. I can click into the admin section but

Re: Web Development with Django: Windows vs Linux/Mac OS X

2008-02-10 Thread NickJ
I am a long time windows user, and have just switched to ubuntu gutsy for the very reason of python and django development. Although the learning curve was very steep - and i have had many hardware issues - i am now much happier developing on ubuntu (I have dual boot set up, but 95% of what i do c

Re: The best practice for a registration and then getting user to fill up extra information

2008-02-10 Thread Ramdas S
James, Thanks! I need to learn to ** search better ** :) RS > > On Feb 10, 2008 8:18 PM, James Bennett <[EMAIL PROTECTED]> wrote: > > > > > On Feb 9, 2008 9:37 AM, Ramdas S <[EMAIL PROTECTED]> wrote: > > > I am using Django-registration. It works like a charm as far as > > registering > > > new

Re: [error] 'str' object has no attribute 'creation_counter'

2008-02-10 Thread Malcolm Tredinnick
On Sun, 2008-02-10 at 09:27 -0500, Prof. William Battersea wrote: > Hello, > > I created a Django application, validated it for errors and ran syncdb > without any problems. I can click into the admin section but as soon > as I click "Add" for one of my models I get the error > AttributeError at

Re: The best practice for a registration and then getting user to fill up extra information

2008-02-10 Thread James Bennett
On Feb 9, 2008 9:37 AM, Ramdas S <[EMAIL PROTECTED]> wrote: > I am using Django-registration. It works like a charm as far as registering > new users and validating them from potential bots. However, what is the best > practice as far as getting users to feed in more information. See django-regis

Re: hosting web

2008-02-10 Thread Ramdas S
I am sorry. You are probably right. But Dreamhost was a nightmare Ramdas On Feb 10, 2008 7:50 PM, Horst Gutmann <[EMAIL PROTECTED]> wrote: > > Although Dreamhost's FastCGI setup is a little weird and quite > restricted to begin with, so I wouldn't judge just based on Dreamhost > that FastCGI is

[error] 'str' object has no attribute 'creation_counter'

2008-02-10 Thread Prof. William Battersea
Hello, I created a Django application, validated it for errors and ran syncdb without any problems. I can click into the admin section but as soon as I click "Add" for one of my models I get the error AttributeError at /admin/gallery/gallery/add/ 'str' object has no attribute 'creation_counter' R

Re: The best practice for a registration and then getting user to fill up extra information

2008-02-10 Thread Ramdas S
Hi Steven, Thanks. However. I am quite keen on Django-registration. I am not very sure about oldforms. Let me see whether I can take some ideas from your code and implement it in mine. Ramdas On Feb 10, 2008 6:14 PM, Steven Armstrong <[EMAIL PROTECTED]> wrote: > Ramdas S wrote on 02/09/08 16:3

Re: hosting web

2008-02-10 Thread Horst Gutmann
Although Dreamhost's FastCGI setup is a little weird and quite restricted to begin with, so I wouldn't judge just based on Dreamhost that FastCGI is a bad deployment option :-) - Horst On Feb 10, 2008 3:15 PM, Ramdas S <[EMAIL PROTECTED]> wrote: > FastCGI support on a shared host is workable, bu

Re: hosting web

2008-02-10 Thread Ramdas S
FastCGI support on a shared host is workable, but for a production site which needs constant maintenance, it might be a bad idea. I've had very bad experience with Dreamhost and so has a dozens of others users. As Jeff suggested look at those web hosters who advertise for Django. Or else, if you k

Re: Simple filter query throwing up an error

2008-02-10 Thread Darthmahon
Thanks for all your help guys - python docs make sense :) On Feb 10, 12:17 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > On Feb 10, 2008 5:59 AM, Darthmahon <[EMAIL PROTECTED]> wrote: > > > Event.objects.filter(date__exact=datetime.now()) > > > Simple enough, but it throws up this error: > > >

Re: Database?

2008-02-10 Thread Daniel Roseman
On 10 Feb, 07:19, waltbrad <[EMAIL PROTECTED]> wrote: > Hi there. I'm a python novice, getting into the Mark Lutz tome. I'm > pretty enthusiastic about python and when I found out that it could be > used in website development I had to look into to Django, (mainly > because of the Satchmo project)

Re: The best practice for a registration and then getting user to fill up extra information

2008-02-10 Thread Steven Armstrong
Ramdas S wrote on 02/09/08 16:37: > Hi, > > I am using Django-registration. It works like a charm as far as registering > new users and validating them from potential bots. However, what is the best > practice as far as getting users to feed in more information. > > Currently in apps I have writt

Re: Simple filter query throwing up an error

2008-02-10 Thread James Bennett
On Feb 10, 2008 5:59 AM, Darthmahon <[EMAIL PROTECTED]> wrote: > Event.objects.filter(date__exact=datetime.now()) > > Simple enough, but it throws up this error: > > AttributeError at /events/today/ > 'module' object has no attribute 'now' You want to read the documentation for Python's datetime

Re: Simple filter query throwing up an error

2008-02-10 Thread Malcolm Tredinnick
On Sun, 2008-02-10 at 03:59 -0800, Darthmahon wrote: > Hey, > > I want to get a list of events that are happening today and I'm using > this query: > > Event.objects.filter(date__exact=datetime.now()) [...] > Any ideas? I'm importing datetime at the top of my views.py file > (where the query

Re: Simple filter query throwing up an error

2008-02-10 Thread Alexander Dutton
Hi Darthmahon, You probably want "from datetime import datetime" at the top, as now() is buried a bit deeper into the module tree than you'd expected. That said, isn't your query going to return everything that's happening at the very instant the query is run? You probably want something like:

Simple filter query throwing up an error

2008-02-10 Thread Darthmahon
Hey, I want to get a list of events that are happening today and I'm using this query: Event.objects.filter(date__exact=datetime.now()) Simple enough, but it throws up this error: AttributeError at /events/today/ 'module' object has no attribute 'now' My model looks like this: title

Re: custom admin action?

2008-02-10 Thread Alex Koshelev
You can create a ImageFIeld subclass with needed functionality of image processing. And use it with some models. On 10 фев, 14:20, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > i have an ImageField in my model (editable only by staff memebrs), i > would like to generate a thumbnail everytime a

Re: Database?

2008-02-10 Thread J. Clifford Dyer
On Sat, 2008-02-09 at 23:19 -0800, waltbrad wrote: > Hi there. I'm a python novice, getting into the Mark Lutz tome. I'm > pretty enthusiastic about python and when I found out that it could be > used in website development I had to look into to Django, (mainly > because of the Satchmo project).

Re: Not using Django's built in auth, getting errors on 404s

2008-02-10 Thread Malcolm Tredinnick
On Sun, 2008-02-10 at 03:05 -0800, Hugh Bien wrote: > Hi, > > > I'm not using Django's built in auth application. When I go to a URL > that doesn't exist, I get this error: > > > AttributeError: 'WSGIRequest' object has no attribute 'user' I suspect that the version of Django you're runni

Re: custom admin action?

2008-02-10 Thread Almir Karic
thank you very much :) On Feb 10, 2008 12:31 PM, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > > On Sun, 2008-02-10 at 03:20 -0800, [EMAIL PROTECTED] wrote: > > i have an ImageField in my model (editable only by staff memebrs), i > > would like to generate a thumbnail everytime a staff memebe

Re: limiting users to one session at a time

2008-02-10 Thread Malcolm Tredinnick
On Sun, 2008-02-10 at 11:00 +, Michael Graz wrote: > Greetings. Would like to be able to prevent a user from having two > concurrent, active sessions. For example want to prevent two sessions > for a specific login from two different machines or browsers. I don't > see an easy way to deact

Re: custom admin action?

2008-02-10 Thread Malcolm Tredinnick
On Sun, 2008-02-10 at 03:20 -0800, [EMAIL PROTECTED] wrote: > i have an ImageField in my model (editable only by staff memebrs), i > would like to generate a thumbnail everytime a staff memeber adds a > new instance of my model, any ideas where to put image thumbnail > generating code? In your m

custom admin action?

2008-02-10 Thread [EMAIL PROTECTED]
i have an ImageField in my model (editable only by staff memebrs), i would like to generate a thumbnail everytime a staff memeber adds a new instance of my model, any ideas where to put image thumbnail generating code? as a side not, is anyone aware of any snippet that takes as input image lis

Not using Django's built in auth, getting errors on 404s

2008-02-10 Thread Hugh Bien
Hi, I'm not using Django's built in auth application. When I go to a URL that doesn't exist, I get this error: AttributeError: 'WSGIRequest' object has no attribute 'user' Here's part of the stack trace: File "/Library/Python/2.5/site-packages/django/views/defaults.py", line 79, in page_not

limiting users to one session at a time

2008-02-10 Thread Michael Graz
Greetings. Would like to be able to prevent a user from having two concurrent, active sessions. For example want to prevent two sessions for a specific login from two different machines or browsers. I don't see an easy way to deactivate or delete existing sessions for a user upon login, which wo

Re: DjangoBook Ch. 7 not working

2008-02-10 Thread James Bennett
On Feb 10, 2008 3:37 AM, rihad <[EMAIL PROTECTED]> wrote: > The first example (the search form) doesn't work either with the same > error (str object is not callable). The book was written for Django 0.96; while most things it covers remain the same in the current development version, not all of

Re: DjangoBook Ch. 7 not working

2008-02-10 Thread rihad
The first example (the search form) doesn't work either with the same error (str object is not callable). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to djan

DjangoBook Ch. 7 not working

2008-02-10 Thread rihad
Hi, has anyone noticed that the example in chapter seven doesn't work with Django SVN revision 7103 (latest)? http://www.djangobook.com/en/1.0/chapter07/ TypeError at /contact/ 'str' object is not callable Request Method: GET Request URL:http://sol.localnet:8000/contact/ Exception Ty

Re: custom 404 error page

2008-02-10 Thread samira
Dear Karen You are absolutely right. Thanks a lot. My problem solved. --~--~-~--~~~---~--~~ 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 unsu