Translation error triggered by HttpResponse

2010-05-04 Thread Derek
The online documentation has the following example in this section: http://docs.djangoproject.com/en/1.0/topics/i18n/#standard-translation from django.utils.translation import ugettext as _ def my_view(request): output = _("Welcome to my site.") return HttpResponse(output) My example lo

HttpResponseRedirect and user message

2010-05-04 Thread xpanta
Hi, I am new to django, and I have this simple task i need to accomplish. in views.py there is a function that processes an html form (with POST action). This function returns an HttpResponseRedirect object. This object gets as parameters the redirect action, like this: return HttpResponseRedirec

Re: django_audit 0.0.2

2010-05-04 Thread Euan Goddard
On May 1, 4:00 am, Dj Gilcrease wrote: > Ya I saw the announcement on it the day I pushed my code to google, > hence my remark about not being tied to a "NoSQL" solution. I had > already created the project name by the time I saw the announcement so > just went with it This is all very well, but

how to change urls for model in admin?

2010-05-04 Thread akonsu
hello, by default an admin url for a model looks like this: http:///admin///... is there a way to change it? for different models i need to have different url structure. say, i want to replace "/admin/" with something else. ModelAdmin.get_urls()? the documentation is not very helpful for me. i

Re: HttpResponseRedirect and user message

2010-05-04 Thread ge...@aquarianhouse.com
i would use reverse and redirect to a "success" page def my_view(request): #do stufff #save info in session return HttpResponseRedirect(reverse('success_url')) def my_success_view(request): #access the session and get the data return render_to_response('success.html', locals()

Re: HttpResponseRedirect and user message

2010-05-04 Thread xpanta
Thank you. One more thing: how to save info in the session? On 4 Μάϊος, 11:27, "ge...@aquarianhouse.com" wrote: > i would use reverse and redirect to a "success" page > > def my_view(request): >     #do stufff >     #save info in session >     return HttpResponseRedirect(reverse('success_url'))

Q objects subquery

2010-05-04 Thread danfis
Hi guys, i ran into a problem today which i'm not sure if it's a bug (or a feature?!) so you might can help me: when i call a model manager method to manipulate the queryset and using Q objects for filtering, it seems like the query of the method (=queryset.query) "stores" the result of subquerie

Re: filebrowser issue

2010-05-04 Thread Nuno Maltez
On Mon, May 3, 2010 at 8:10 PM, Bobby Roberts wrote: > hey I have a strange issue.  I was having trouble getting django- > tinymce and filebrowser working.  I've worked through all of the > errors etc.  In filebrowser, I can create a new directory, but when i > try to upload a file or image, nothi

Re: django_audit 0.0.2

2010-05-04 Thread Dj Gilcrease
On Tue, May 4, 2010 at 4:21 AM, Euan Goddard wrote: > This is all very well, but should either of these projects get to pypi > there's going to be some serious trouble. Since I'm the main author of > the "noSQL" django-audit, please let me know how you want to proceed. > I'm already using the proj

Re: Q objects subquery

2010-05-04 Thread Daniel Roseman
On May 4, 9:53 am, danfis wrote: > Hi guys, > > i ran into a problem today which i'm not sure if it's a bug (or a > feature?!) so you might can help me: > > when i call a model manager method to manipulate the queryset and > using Q objects for filtering, it seems like the query of the method > (=

Re: HttpResponseRedirect and user message

2010-05-04 Thread Daniel Roseman
On May 4, 9:43 am, xpanta wrote: > Thank you. One more thing: how to save info in the session? Read the fine documentation: http://docs.djangoproject.com/en/1.1/topics/http/sessions/ -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To po

TypeError with a Decimal Field

2010-05-04 Thread JonathanB
I'm working on a Grade Book program for my personal use. Here is the relevant class from my models.py file: class Grade(models.Model): student = models.ForeignKey(Student) assignment = models.ForeignKey(Assignment) grade = models.DecimalField(max_digits=5, decimal_places=2)

Re: TypeError with a Decimal Field

2010-05-04 Thread Daniel Roseman
On May 4, 1:15 pm, JonathanB wrote: > I'm working on a Grade Book program for my personal use. Here is the > relevant class from my models.py file: > > class Grade(models.Model): >         student = models.ForeignKey(Student) >         assignment = models.ForeignKey(Assignment) >         grade = m

Re: Q objects subquery

2010-05-04 Thread danfis
thanks for your advise daniel, is see it now and the hint with values_list works great. thanks again On 4 Mai, 13:11, Daniel Roseman wrote: > On May 4, 9:53 am, danfis wrote: > > > > > > > Hi guys, > > > i ran into a problem today which i'm not sure if it's a bug (or a > > feature?!) so you mi

Re: send an email to users after saving is_active=True

2010-05-04 Thread Sander
someone got an answer to this one? is there some kind of is_activated signal? Sander On Apr 3, 6:19 pm, Alessandro Ronchi wrote: > I need to notify users when an admin activate them saving their > profile withis_active=True. > > Is it possible? > How? > I need also to avoidemailduplication when

Re: send an email to users after saving is_active=True

2010-05-04 Thread ge...@aquarianhouse.com
if you don't use django-registration, when listen on signal post_save for User, check if is_active == True and do something. On May 4, 2:45 pm, Sander wrote: > someone got an answer to this one? > is there some kind of is_activated signal? > > Sander > > On Apr 3, 6:19 pm, Alessandro Ronchi > wr

Internationalization

2010-05-04 Thread Daniel Baron
Hi all, I have two questions regarding i18n to which I find very little or even no information. I hope someone can help. The first question is whether django supports the declaration of a message context (msgctxt) in the .po-files in order to have different translations for the same string i

Re: Uploads in the Form Wizard

2010-05-04 Thread Russell Keith-Magee
On Mon, May 3, 2010 at 12:02 PM, Wiiboy wrote: > What would be the best workaround (or is there one)? > Perhaps overriding FormWizard.process_step()? The only obvious workaround I can think of is to treat the N-form wizard problem as a (N-1) form wizard, plus 1 normal form that handles file uploa

Re: QuerySet.distinct and aggregates

2010-05-04 Thread zinckiwi
> In [16]: > Alpha.objects.filter(gamma__beta__name='Beta').aggregate(models.Sum('id')) > Out[16]: {'id__sum': 2} > > In [17]: > Alpha.objects.filter(gamma__beta__name='Beta').distinct().aggregate(models. > Sum('id')) > Out[17]: {'id__sum': 2} > > As you can see, the aggregate call in 17 ignores t

Re: send an email to users after saving is_active=True

2010-05-04 Thread Sander
I don't want to check if if_active = True I wan't to check if if_active is changed to True On May 4, 2:50 pm, "ge...@aquarianhouse.com" wrote: > if you don't use django-registration, when listen on signal post_save > for User, check if is_active == True and do something. > > On May 4, 2:45 pm, S

Re: send an email to users after saving is_active=True

2010-05-04 Thread zinckiwi
On May 4, 9:49 am, Sander wrote: > I don't want to check if if_active = True > I wan't to check if if_active is changed to True If you use the pre_save signal, you can get the object as it currently exists (based in the signalled instance's pk) and compare the existing object's `is_active` with t

Re: Following Django Book, get NameError when accessing certain page

2010-05-04 Thread Karen Tracey
On Sun, May 2, 2010 at 11:16 PM, kelp wrote: > Yes, I did that, but for some reason, it is still not working, here's > the contents of my views.py: > from django.http import HttpResponse > from django.shortcuts import render_to_response > import datetime > > def hello(request): >return HttpRe

Re: Internationalization

2010-05-04 Thread Baurzhan Ismagulov
On Tue, May 04, 2010 at 02:47:35PM +0200, Daniel Baron wrote: > The first question is whether django supports the declaration of a > message context (msgctxt) in the .po-files in order to have different > translations for the same string in different positions of the > application. A hack cou

Equivalent of php json_encode?

2010-05-04 Thread zweb
Is there a django or python equivalent of php json_encode? the data I am converting to json has text fields that have quotes, double quotes, newlines and html tags. Creating json manually in my program without escaping or converting these special characters is causing problem on javascript side.

Re: Equivalent of php json_encode?

2010-05-04 Thread ge...@aquarianhouse.com
sure, simplejson is your helper On May 4, 4:34 pm, zweb wrote: > Is there a django or python equivalent of php json_encode? > > the data I am converting to json has text fields that have quotes, > double quotes, newlines and html tags. Creating json manually in my > program without escaping or co

Re: Equivalent of php json_encode?

2010-05-04 Thread Daniel Hilton
On 4 May 2010 15:34, zweb wrote: > Is there a django or python equivalent of php json_encode? > > the data I am converting to json has text fields that have quotes, > double quotes, newlines and html tags. Creating json manually in my > program without escaping or converting these special characte

Re: override a form field, to allow usernames with '@'

2010-05-04 Thread Bill Freeman
Consider that there may be some third party app which you will want to add in the future, and that it may depend on the existing nature of usernames. (E.g.; uses username as a slug and uses a simple regular expression in a url pattern to capture the username. Consider that usernames are currently

Re: override a form field, to allow usernames with '@'

2010-05-04 Thread Nick Serra
I just implemented this and it's a hassle. There are heated discussions about it. I ended up modifying the auth app and completely eliminating the 'username' field and just using email. Then I modified the admin app to allow the login, and am basically just completely overriding both. Good luck! O

Re: Admin custom filters

2010-05-04 Thread Massimiliano della Rovere
The filters are not documented. You can learn how they works, looking at the file DJANGO_PATH/contrib/admin/filterspecs.py I found DateFieldFilterSpec to be useful whenever you need to filter something that is in a range, not just for calendar matters. On Mon, May 3, 2010 at 23:23, Thales wrote

Re: Translation error triggered by HttpResponse

2010-05-04 Thread Karen Tracey
On Tue, May 4, 2010 at 3:28 AM, Derek wrote: > The online documentation has the following example in this section: > > http://docs.djangoproject.com/en/1.0/topics/i18n/#standard-translation > > from django.utils.translation import ugettext as _ > > def my_view(request): >output = _("Welcome t

LOCALE_PATHS in settings.py required?

2010-05-04 Thread janedenone
Hi, according to http://docs.djangoproject.com/en/1.1/howto/i18n/ Django automatically looks for localizations in $PROJECTPATH/locale/ /LC_MESSAGES/django.(po|mo). When I installed language files in this location, however, they were found only after I added LOCALE_PATHS to settings.py. Did I mi

Re: LOCALE_PATHS in settings.py required?

2010-05-04 Thread Baurzhan Ismagulov
On Tue, May 04, 2010 at 08:10:18AM -0700, janedenone wrote: > according to > > http://docs.djangoproject.com/en/1.1/howto/i18n/ > > Django automatically looks for localizations in $PROJECTPATH/locale/ > /LC_MESSAGES/django.(po|mo). When I installed language files > in this location, however, they

Support of settings.ADMIN_FOR

2010-05-04 Thread lazerscience
Hi! I'm working on creating a Django Setup, where i can manage multiple sites through one admin using Django's sites framework. During my researches I came across the ADMIN_FOR setting, which seems to be something I could need, but there's hardly any documentation about it, so i looked at django's

Re: Decode a JSON object?

2010-05-04 Thread esatterwh...@wi.rr.com
use the simplejson module from django.utils import simplejson I think your code is having problems becuase you are trying to deserialize something that isn't a json string, its an object. On May 3, 11:33 am, Thomas Allen wrote: > How can I parse a simple JSON object in Django? > > I would like t

Trouble with multi-db test suite.

2010-05-04 Thread J. Cliff Dyer
I'm having trouble working with multi-db using mysql replication. When I run our test suite, I'm getting several hundred errors if I have more than one database configured, and none if I have only one configured. It seems that something isn't getting properly cleared out between test cases, so du

Customize what's a NULL for legacy data

2010-05-04 Thread Ole Laursen
Hi! I have a problem. I'm dealing with a legacy database where some of the foreign keys aren't pointing to the right place because 0 (and -1) has been used in some places instead of NULL. I can't fix the rows as the new application will have to live side by side with the legacy system for some tim

change an object from parent to child

2010-05-04 Thread Steve Bywater
Given... class Place(models.Model): name = models.CharField(max_length=50) class Restaurant(Place): serves_hot_dogs = models.BooleanField() ...it is trivial to create either a place or restaurant. But how do you take an instance that is already a place and create a restaurant from it? Is

Noob questions: Syntax, Python listserv, utility/helper methods?

2010-05-04 Thread mhulse
I come from the PHP/CodeIgniter/Actionscript/Other world I am slowly learning Django and Python. + Question 01: Sorry if OT... This is kinda more of a Python question. :( In as3 oop, I like to do this (for example): = ... public class ClickTag { // Private:

Re: Noob questions: Syntax, Python listserv, utility/helper methods?

2010-05-04 Thread Peter Herndon
On May 4, 2010, at 2:29 PM, mhulse wrote: > + > > Question 01: > > Going back to the AS example, I really dig using a dollar sign for > method arguments and the underscore for class properties. > > Does Python/Django allow for anything similar? :) Not as such. Names (of anything)

Internationalization of UserCreationForm

2010-05-04 Thread Jacek
Well, I need to translate field names (labels) in register form (UserCreationForm). I have checked that django.contrib.auth.forms use hooks for internationalization (I mean ugettext_lazy). But when I run django-admin.py makemessages, my output locale file doesn't contain any strings from the form.

Re: Internationalization of UserCreationForm

2010-05-04 Thread Felippe Bueno
I'm not sure if is this, what you are looking for, But I use, some like this: forms.py: from django.utils.translation import ugettext as _ from django.contrib.auth.models import User from django import forms class RegForm(forms.Form): fname = forms.CharField(label=_('First Name'),max_len

Re: Internationalization of UserCreationForm

2010-05-04 Thread Karen Tracey
On Tue, May 4, 2010 at 3:20 PM, Jacek wrote: > Well, I need to translate field names (labels) in register form > (UserCreationForm). I have checked that django.contrib.auth.forms use > hooks for internationalization (I mean ugettext_lazy). > But when I run django-admin.py makemessages, my output

sqlite3 backend error

2010-05-04 Thread mf
Hi, before installing Ubunto 10.04 all of my projects worked pretty well. Now I'm getting an error and I don't know how to solve it. This is the result of running the python manage.py runserver command: django.core.exceptions.ImproperlyConfigured: 'django.db.backends.sqlite3' isn't an available d

Re: Internationalization of UserCreationForm

2010-05-04 Thread Jacek
Oh, I didn't think that they could be already translated. Yeah, I have changed LANGUAGE_CODE and everything is working now. I didn't think it could be done so automatically. :) Thanks a lot. However, supposing I wanted to change translation (for example, I'm not happy with it), would it be very di

Re: QuerySet.distinct and aggregates

2010-05-04 Thread Wedg
Hrm... didn't quite work... In [18]: Alpha.objects.filter(gamma__beta__name='Beta').values('name') Out[18]: [{'name': u'Alpha'}, {'name': u'Alpha'}] In [19]: Alpha.objects.filter(gamma__beta__name='Beta').values('name').annotate(subtotal=models.Sum('id')) Out[19]: [{'subtotal': 2, 'name': u'Alpha

Re: change an object from parent to child

2010-05-04 Thread Shawn Milochik
You can't subclass an instance, just a class/object. Maybe you want a foreign key to place in restaurant. What are you trying to do? Shawn -- 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...@goog

Password reset email not sent

2010-05-04 Thread janedenone
Hi, when using Django's password reset mechanism, the confirmation email is not sent (although some of my custom views do send email successfully using the SMTP configuration from settings.py). Also, I understand that the reset link in the email contains the user ID, but it is based on the email

Re: Password reset email not sent

2010-05-04 Thread Shawn Milochik
I don't know why your e-mail isn't being sent, but I know that if multiple User instances have the same e-mail address, then that e-mail address will receive one message per User. Each one will specify the username, so it's easy to reset the correct password. Shawn -- You received this messa

Re: LOCALE_PATHS in settings.py required?

2010-05-04 Thread janedenone
On 4 Mai, 17:25, Baurzhan Ismagulov wrote: > On Tue, May 04, 2010 at 08:10:18AM -0700, janedenone wrote: > > according to > > >http://docs.djangoproject.com/en/1.1/howto/i18n/ > > > Django automatically looks for localizations in $PROJECTPATH/locale/ > > /LC_MESSAGES/django.(po|mo). When I install

AdminField Rendering Question

2010-05-04 Thread geraldcor
Hello all, I have been pouring over the django source trying to figure out where the "Currently: "/images/..."" gets added to ImageField upload fields after an image has been uploaded in the admin interface. I wonder this because I would like to do some custom manipulation with the image field and

Re: Error with django-registration

2010-05-04 Thread andy saksena
Resolved Thanks for the help. On May 3, 2:07 pm, andy saksena wrote: > Thats been resolved James but there is another thing I'm having > problems with and I'm sorry for asking so many questions. > All I now want is to have a minimum of 6 characters in the password > field. > Thanks > > On May 3,

Re: error in urls.py

2010-05-04 Thread andy saksena
Thanks that resolved. On May 3, 5:41 pm, Daniel Roseman wrote: > On May 3, 8:27 am,andysaksena wrote: > > > > > Hi > > > my urls.py is > > > from django.conf.urls.defaults import * > > > # Uncomment the next two lines to enable the admin: > > from django.contrib import admin > > admin.autodisco

Re: Trouble with multi-db test suite.

2010-05-04 Thread Russell Keith-Magee
On Wed, May 5, 2010 at 1:43 AM, J. Cliff Dyer wrote: > I'm having trouble working with multi-db using mysql replication.  When > I run our test suite, I'm getting several hundred errors if I have more > than one database configured, and none if I have only one configured. > > It seems that somethi

Re: Django-grappelli issue

2010-05-04 Thread Tran Cao Thai
It works. Thank you very much. On Mon, May 3, 2010 at 2:21 AM, Scot Hacker wrote: > On May 1, 10:12 pm, Tran Cao Thai wrote: > > I discovered the grappelli app today and just set up it. However, the > admin > > site doesn't look as good as the screenshot from the site. Here is the > > screensho

Re: how to change urls for model in admin?

2010-05-04 Thread Wayne
Hi, I am looking for the answer as well. I came across this tutorial with some sample code. http://lincolnloop.com/assets/Customizing_the_Django_Admin-EuroDjangoCon09.pdf page 59. However, I don't want to create new view, but just modify the display urls. So if somebody could give any hint, that

Re: add button to admin change list at row level.

2010-05-04 Thread Wayne
Thanks for your hint. It worked out pretty well. Wayne On May 2, 4:06 am, Daniel Roseman wrote: > On May 2, 4:29 am, Wayne wrote: > > > Hi, > > > We are trying to customize Django admin change list displaying model > > objects. We want to add two buttons (Change, delete) to each row of > > the

heads up

2010-05-04 Thread darren
I thought I would pass this along in case it helps anyone. A recent update on my Mac broke my python symlink. I have my /usr/bin/python pointing to /usr/local/bin/python2.6 via a symlink. My modules are located in /usr/local/lib/python2.6. If you are experiencing a problem with importing module

Re: Equivalent of php json_encode?

2010-05-04 Thread Streamweaver
I've found the native Python JSON library about the easiest to use out there. http://docs.python.org/library/json.html On May 4, 10:34 am, zweb wrote: > Is there a django or python equivalent of php json_encode? > > the data I am converting to json has text fields that have quotes, > double quo

Working out some custom API stuff

2010-05-04 Thread Nick
Here's the deal. I'm working on a custom API for moving information about. I am stuck at a point in creating my view. It might be best just to get into the details. Here is the model: class entry(models.Model): question = models.CharField('Question', max_length=200, blank=False) answer =

Empty foreign keys in forms after Apache/PostgreSQL reset

2010-05-04 Thread Xanthus
Hi all. I will try do my best to explain my setup and the sequence of actions triggering the issue: 1. Machine starts and all is fine. 2. We do the following operations (through and automated script): a. stop Apache b. stop Postgresql c. drop database d. create database again e. restore database f

Re: TypeError with a Decimal Field

2010-05-04 Thread JonathanB
Yep, see I knew I was doing something simple wrong. The real irony is, returning just the grade was a placeholder till I came up with a better idea of exactly what I wanted there Thank you! On May 4, 9:40 pm, Daniel Roseman wrote: > On May 4, 1:15 pm, JonathanB wrote: > > > > > > > I'm worki

Django 1.2 and legacy database

2010-05-04 Thread Xavier Ordoquy
Hello, I'm seriously considering django 1.2 for a project which uses several databases. However, I still got an issue with django 1.2 about legacy database. I do have many to many relation that goes throught and table without primary key. I don't want to use an intermediate model since it adds ab