transactions

2010-03-29 Thread Continuation
If I have a view function that transfers money from savings to checking account, is @transaction.commit_on_success the recommend way to manage the transaction? So something like: @transaction.commit_on_success def transfer(request): ... savings.withdraw(amount)

Having trouble accessing a many-to-many to field inside a result set

2010-03-29 Thread Daniel
Hi there, I'm in a template that is trying to simply show everything in my database. But I can't seem to do it even though this should be dead simple :<. Here is my view, called browse_all: def browse_all(request): resultSet = Sample.objects.all(); print resultSet

Multiple tables, is Django suited for this?

2010-03-29 Thread Matthias
I'm relatively new to the Django world and I'm just starting on a new project that may be right up the frameworks ally. But there's one thing I'm a little iffy on after reading the documentation. I'm attempting to write an app that will allow for management of a "parts" database that will allow

Re: assert_performant(query_set)

2010-03-29 Thread Phlip
Russell Keith-Magee wrote: > Sorry - a point of clarification. the technique I gave you is 1.2 > specific. There's no analog under 1.1, because 1.1. doesn't support > multiple databases. That explains a lot; tx. My current impediment - probably nothing to do with Django - is ...

Re: assert_performant(query_set)

2010-03-29 Thread Russell Keith-Magee
On Tue, Mar 30, 2010 at 12:05 AM, Phlip wrote: >> qs.query.get_compiler(qs.db).as_sql() > > That gives this error message with the usual zero Google hits for that > error message: > >  AttributeError: 'BaseQuery' object has no attribute 'get_compiler' Sorry - a point of

Re: Using Mako as a templating language

2010-03-29 Thread Russell Keith-Magee
On Mon, Mar 29, 2010 at 12:34 AM, Colin wrote: > After struggling with Django's templating language for a while, I > decided I wanted to switch to something with a bit more power. In > particular, I liked what I saw of Mako (being able to instantiate new > variables, and

Re: I am having issues with django test

2010-03-29 Thread Phlip
>     def setUp(self): >         user = User.objects.create_user(USER, '@nowhere.com', PASS) That's what fixtures are for! -- 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...@googlegroups.com.

Re: mod_wsgi broken in rev #12866

2010-03-29 Thread nih
> editing django/utils/translation/__init__.py yea looks like that was the problem, all the fixes in rev #12875 sorted the problem and everything still works in the latest trunk #12882 thanks Russ! Thanks Graham, I saw that blog post earlier but haven't had time to read it, I should have time

Re: custom locale directory

2010-03-29 Thread Baurzhan Ismagulov
On Mon, Mar 29, 2010 at 11:58:17AM -0700, Valentin Golev wrote: > How to tell django about the locale? It does not seem like it will > find the /locale/ folder by itself I'm using the following: LOCALE_PATHS = ('/locale', ) With kind regards, -- Baurzhan Ismagulov http://www.kz-easy.com/ --

Re: How to share settings file in multiprogrammer project

2010-03-29 Thread Phlip
> The test_settings and dev_settings should point to a PASSWORDLESS > database with localhost-only permissions. The production_settings file > should not be committed. It's the one copied up to the server. Come to think of it, what I'm screaming about here is three separate things: - developer

Re: How to share settings file in multiprogrammer project

2010-03-29 Thread Phlip
Guillermo wrote: > I'm working on a project with multiple programmers for the first time, > and I'm not sure how I should go about commiting the Django project's > setting file to the public repo. Since it can contain sensitive data, It should not contain sensitive data. You should write

custom locale directory

2010-03-29 Thread Valentin Golev
Hello! I'm developing a project with two different sites, divided by language. Maybe I was terribly wrong, but now my directory structure looks like: /ruapp/settings.py # SITE_ID =1 /ruapp/manage.py /enapp/settings.py # SITE_ID = 2 /enapp/manage.py /common/urls.py /common/ # almost every other

Use admin widgets in inlineformset_factory

2010-03-29 Thread Fredrik
Hi, I have this forms.py file --- # -*- coding: utf-8 -*- from django.contrib.admin.widgets import FilteredSelectMultiple from django.forms.models import inlineformset_factory from

Re: HTML code shown on web page after template render.

2010-03-29 Thread gvernold
Thanks Baxter. If I don't store HTML code in the database though where do I store it? Do I just create a lot of different HTML snippets in the templates that might possibly be used? Or do I create lots of mini- templates and use inheritance? On Mar 29, 12:53 pm, "bax...@gretschpages.com"

Re: HTML code shown on web page after template render.

2010-03-29 Thread bax...@gretschpages.com
I would generally recommend against storing html in the database, but if you're going to, and if you KNOW that it's safe, you have to mark it safe: {{ obj.stuff|safe }} On Mar 29, 12:36 pm, gvernold wrote: > Hi fellow Djangoists > > I've got some content with embedded

chronograph dtstart until params

2010-03-29 Thread Tim Daniel
Hi there, I've tried to contact with the people related to the django- chronograph project, but without success. When you create a new job there is a field called Params, there you should be able to specify when your job is run following the rrule rules. So the only parameter that seems to work

Re: raw sql

2010-03-29 Thread Nuno Maltez
>        self.fields['man'].queryset=Pupil.objects.filter(gender='M') >        self.fields['woman'].queryset=Pupil.objects.filter(gender='F') > > It returns only the man and woman for each combo box. Now, also, I only want > the User wich aren't Teacher. How can I do this? I've tried with

HTML code shown on web page after template render.

2010-03-29 Thread gvernold
Hi fellow Djangoists I've got some content with embedded html tags in a database. When I pass the content for rendering with a template through the Django templating system the web page actually prints the html tags rather than parsing through the browser (for instance actually prints rather

Re: Cassandra backend

2010-03-29 Thread Ricardo Bánffy
It would be more on the lines of the first one. I guess folks intent to pretend, as much as possible, that we are running vanilla Django - and, perhaps, deploy to a RDBMS and only move to a non-relational store if the app is successful enough. Thanks! There is a lot to catch up. On Mon, Mar 29,

deepcopying form classes and thread safety

2010-03-29 Thread HARRY POTTRER
I have a model form in my project that has a field that is swapped out for another field based on user preferences. Some users want a select the value from a dropdown box, other people want to just type the value into a textbox. Before I had it like this: def proper_flight_form(profile): """

Re: probleme with delete on cascade with foreign key self-referencing

2010-03-29 Thread Nuno Maltez
Hello, Are you sure you don't have a cyclic reference in there: cat1 -> cat2 -> cat1 ? You can always insert a import pdb; pdb.set_trace() line in the method and use the debugger to figure out what's keeping the loop from exiting normally. Nuno On Mon, Mar 29, 2010 at 2:55 PM, mouadino

Re: Error in image upload while copying file

2010-03-29 Thread pjmorse
On Mar 29, 8:22 am, bruno desthuilliers wrote: > On 19 mar, 20:05,pjmorse wrote: > > > In my application's admin console, there's a tiny form for updating > > the image associated with a specific model. > > > When a file is uploaded, the

Re: Weird path problem

2010-03-29 Thread bax...@gretschpages.com
Looks like it was a pythonpath thing. -- 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...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com.

soliciting interest in a medical open source project to save the world

2010-03-29 Thread Mark
OK, maybe it won't save the world. My name is Mark Morgan and I'm working on a project which might be of interest to some of you. I'm a family doctor in Minnesota and I'm associated with a really, really big clinic in Minnesota as well as the US Indian Health Service. Neither institution is

Re: assert_performant(query_set)

2010-03-29 Thread Phlip
>  * Similarly, connection.cursor() will only work in the single > database case. connections[qs.db].cursor() Aaaand that's not working either. (No connections, no qs.db.) I must take a break until someone unravels all this, because I don't know enough about the architecture inside QuerySet...

Re: assert_performant(query_set)

2010-03-29 Thread Phlip
>   AttributeError: 'BaseQuery' object has no attribute 'get_compiler' qs._as_sql() returns a tuple of a SELECT statement, and a (), presumably with wildcards; I will start there. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: assert_performant(query_set)

2010-03-29 Thread Phlip
> qs.query.get_compiler(qs.db).as_sql() That gives this error message with the usual zero Google hits for that error message: AttributeError: 'BaseQuery' object has no attribute 'get_compiler' -- You received this message because you are subscribed to the Google Groups "Django users" group.

Weird path problem

2010-03-29 Thread bax...@gretschpages.com
my setup is like this: /apps/ /apps/app1/ /apps/app2/ /projects/ /myproject/ I've got it set up that way because multiple projects use multiple apps. Because of that setup, I use django-admin.py, specifying the project. Anyways, from the admin and site side of things, everything looks

Re: I am having issues with django test

2010-03-29 Thread Paulo Almeida
This doesn't answer your question, but it may help you solve the problem. I have this class in my tests: class LoggedInUser(TestCase): def setUp(self): user = User.objects.create_user(USER, 'm...@nowhere.com', PASS) self.client.login(username=user.username, password=PASS)

Re: Converting cleaned ModelMultipleChoiceField to a list of ids

2010-03-29 Thread Wilberoni
Thanks Shawn. Funny that you posted the anwer at exactly the same time it occurred to me. -- 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...@googlegroups.com. To unsubscribe from this group, send

Re: Using ModelForm to edit ManyToMany in both directions?

2010-03-29 Thread Wilberoni
That's fantastic! I did it using one of the alternatives he describes (separate form with constructor/save code to manually select, extract and set the ManyToMany) and it was fairly unpleasant. Thanks for point this out. -- You received this message because you are subscribed to the Google

Re: change modelform values after POST

2010-03-29 Thread Paulo Almeida
It depends on what you want. You can set 'created_by' to blank=True and null=False, so it doesn't have to be filled but it is still mandatory in the database. Or, if you never want to set it in the form, you can make it 'editable=False' and it doesn't show up in the form, but it can still be NOT

Django HttpResponse performance with mimetype=application/atom+xml or text/xml

2010-03-29 Thread serjant
Hi all. Can somebody help me and point me to solving the following problem: 1. I am writing an application where I render the needed information in the XML file (to be more specific GeoRSS) 2. I am generating the GeoRSS with the means of the GeoAtom1RSS django class, and passing it to

Re: Displaying the fields of two tables on the same admin page

2010-03-29 Thread Asim Yuksel
I am entering them on the same page otherwise I will have to note down the ids of people and publications table and then go to bridge table and insert the ids there. So the reason I want to enter in the same page is I will insert the ids into bridge table whenever I click save. I am not allowed to

Re: Using Mako as a templating language

2010-03-29 Thread Simone Orsi
Hi, On 03/28/2010 06:34 PM, Colin wrote: > Or any other templating language that's a bit looser in allowing a bit > of logic to mix in with the presentation layer? > http://mockit.blogspot.com/2010/02/using-chameleon-in-django.html -- You received this message because you are subscribed to

Re: Cassandra backend

2010-03-29 Thread Daniel Hilton
2010/3/29 Ricardo Bánffy : > Hi. > > I am about to be asked to either find a way to use Cassandra as a > database backend or create one. Is there anyone working on something > like this? > Do you mean writing a database backend for django ORM that supports Cassandra? Have a

Cassandra backend

2010-03-29 Thread Ricardo Bánffy
Hi. I am about to be asked to either find a way to use Cassandra as a database backend or create one. Is there anyone working on something like this? -- Ricardo Bánffy http://www.dieblinkenlights.com http://twitter.com/rbanffy -- You received this message because you are subscribed to the

Re: How to integrate a two step admin-action in the admin pages layout

2010-03-29 Thread derek
On Mar 29, 10:08 am, Massimiliano della Rovere wrote: > I am writing a two step admin action: > 1) select the items you want to mass-modify and click the action > 2) enter the values that will be processed for each selected item > 3) finally go back to the item

Re: Passing context variables from template to view

2010-03-29 Thread derek
On Mar 29, 3:48 pm, Javier Guerra Giraldez wrote: > On Mon, Mar 29, 2010 at 3:07 AM, derek wrote: > > Is there a possibility to store longer term data in the session > > variable (assuming one is dealing with logged-in users)? > > you should write that

Re: probleme with delete on cascade with foreign key self-referencing

2010-03-29 Thread ge...@aquarianhouse.com
i think like this: def delete_all(self): Categories.objects.filter(parent_category=self).delete() On Mar 29, 3:55 pm, mouadino wrote: > hello everybody > > I have a model class where i m  using a foreign key self-referencing > here is my code : > > class

probleme with delete on cascade with foreign key self-referencing

2010-03-29 Thread mouadino
hello everybody I have a model class where i m using a foreign key self-referencing here is my code : class Categories(custom.Model): url = models.ForeignKey(Urls, null=True, blank=True) category = models.CharField(max_length=128) parent_category = models.ForeignKey('self',

Re: Passing context variables from template to view

2010-03-29 Thread Javier Guerra Giraldez
On Mon, Mar 29, 2010 at 3:07 AM, derek wrote: > Is there a possibility to store longer term data in the session > variable (assuming one is dealing with logged-in users)? you should write that data to the user's profile; or to any DB record with a ForeingKey to the User

Re: Using Mako as a templating language

2010-03-29 Thread Javier Guerra Giraldez
On Sun, Mar 28, 2010 at 12:34 PM, Colin wrote: > Or any other templating language that's a bit looser in allowing a bit > of logic to mix in with the presentation layer? PHP -- Javier -- You received this message because you are subscribed to the Google Groups

Re: content type printed as first line in mails

2010-03-29 Thread het.oosten
Thank you for the answers! Everything is much clearer now :-) -- 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...@googlegroups.com. To unsubscribe from this group, send email to

Re: content type printed as first line in mails

2010-03-29 Thread bruno desthuilliers
On 29 mar, 13:49, Vinicius Mendes wrote: > Django algo has a shortcut called django.template.loader.render_to_string. Mmm, yes, indeed. Forgot about that one, thanks for the reminder !-) -- You received this message because you are subscribed to the Google Groups "Django

Re: Error in image upload while copying file

2010-03-29 Thread bruno desthuilliers
On 19 mar, 20:05, pjmorse wrote: > In my application's admin console, there's a tiny form for updating > the image associated with a specific model. > > When a file is uploaded, the application reaches this code: > >         if request.method == 'POST': >                

Re: Error in image upload while copying file

2010-03-29 Thread pjmorse
Continued research (I kept asking people) suggests that this is a consequence of moving from Python2.4 to Python2.5. The options appear to be: * Downgrade Python to 2.4 * Find a "more compatible" copy method. I'd really rather not downgrade Python, but I don't know how to find a "more

Deleting a user generates a comment related error

2010-03-29 Thread mtnpaul
trying to delete a user via admin results in the following error message: relation "django_comments" does not exist. I'm not using regular comments but threaded comments. Any idea how to fix this problem (without creating a fake django_comments table)? Django 1.1.1 Thanks, Paul -- You

Re: content type printed as first line in mails

2010-03-29 Thread Vinicius Mendes
Django algo has a shortcut called django.template.loader.render_to_string. __ Vinícius Mendes Solucione Sistemas http://solucione.info/ On Mon, Mar 29, 2010 at 8:15 AM, bruno desthuilliers < bruno.desthuilli...@gmail.com> wrote: > On 29 mar, 10:47, "het.oosten"

Re: tag generates another tags

2010-03-29 Thread Vinicius Mendes
You can include a template with area 1 and inside this template, you add the other tags. __ Vinícius Mendes Solucione Sistemas http://solucione.info/ On Sun, Mar 28, 2010 at 6:26 PM, Sławek Tuleja wrote: > Hi all! > my question is: can 'tag'

Re: Initializing a ModelForm don't work - BUG ?

2010-03-29 Thread bruno desthuilliers
On 29 mar, 09:12, Thierry Chich wrote: > Le lundi 29 mars 2010 02:14:34, pjrhar...@gmail.com a écrit :> > OK. I can > also put an hidden field in my form. I will evaluate what is > > > the better option for me. > > > Bear in mind if you exclude it from your form

Re: content type printed as first line in mails

2010-03-29 Thread bruno desthuilliers
On 29 mar, 10:47, "het.oosten" wrote: > When I send mails with my Django app the first line of every mail is: > Content-Type: text/html; charset=utf-8 > > When i watch the message source i noticed that charset=utf-8 is > changed into charset=3Dutf-8 > > I also saw that in

Re: noob: cyclic import issue

2010-03-29 Thread bruno desthuilliers
On 29 mar, 12:16, vamsy krishna wrote: > thnx jonas...i figured datz wat i mite do... Totally OT, but talking "datz way" won't make you looks "kewl" here. > so django has a limitation > on imports like in da case i mentioned? > It's not a django limitation, it's a

Re: Displaying the fields of two tables on the same admin page

2010-03-29 Thread pjrhar...@gmail.com
> I cant use inlines option ind admin,py because the > tables should be related. If they aren't related why would you want to be entering them on the same page? When you come to edit them again what two instances should be loaded together if they are completely unrelated? Given what you first

Re: noob: cyclic import issue

2010-03-29 Thread vamsy krishna
thnx jonas...i figured datz wat i mite do...so django has a limitation on imports like in da case i mentioned? On Mar 29, 2:51 pm, Jonas Obrist wrote: > On 03/29/2010 10:28 AM, vamsy krishna wrote: > > > hi...am very new to django and am having some problem with my code... >

Re: noob: cyclic import issue

2010-03-29 Thread Jonas Obrist
On 03/29/2010 10:28 AM, vamsy krishna wrote: hi...am very new to django and am having some problem with my code... say i've two modules...mod1 n mod2...n views in both modules have certain generic functions which i need to import from each other...as in (in views.py of mod1) from mod2.views

noob: cyclic import issue

2010-03-29 Thread vamsy krishna
hi...am very new to django and am having some problem with my code... say i've two modules...mod1 n mod2...n views in both modules have certain generic functions which i need to import from each other...as in (in views.py of mod1) from mod2.views import xyz (and in views.py of mod2) from

Re: How to share settings file in multiprogrammer project

2010-03-29 Thread Gustavo Narea
We use Paste Deploy configuration files [1] and we have a main/base configuration file under version control, which gets overridden with a non-versioned configuration file with holds all the sensitive information specific to that instance of the application. This way, such information is not

content type printed as first line in mails

2010-03-29 Thread het.oosten
When I send mails with my Django app the first line of every mail is: Content-Type: text/html; charset=utf-8 When i watch the message source i noticed that charset=utf-8 is changed into charset=3Dutf-8 I also saw that in the message header the mail is marked as: Content-Type: text/plain;

Re: Initializing a ModelForm don't work - BUG ?

2010-03-29 Thread Thierry Chich
Le lundi 29 mars 2010 02:14:34, pjrhar...@gmail.com a écrit : > > OK. I can also put an hidden field in my form. I will evaluate what is > > the better option for me. > > Bear in mind if you exclude it from your form altogether there is > nothing to stop a malicious user setting it by modifying

How to integrate a two step admin-action in the admin pages layout

2010-03-29 Thread Massimiliano della Rovere
I am writing a two step admin action: 1) select the items you want to mass-modify and click the action 2) enter the values that will be processed for each selected item 3) finally go back to the item list page with a user_message informing her/him about the outcome. I am trying to create a

failover partner

2010-03-29 Thread san
hi all, i am trying to connect to mssql server using pyodbc. i am connecting to two databases each one on defferent instances, one is default instance and another is client instance. whenever my default instance mssql server is runnning, i can access both instances database. but when my default

Re: Passing context variables from template to view

2010-03-29 Thread derek
On Mar 26, 5:58 pm, Bill Freeman wrote: > Actually, by the time your user can click a button the "result-set" is no > longer around, because thecontextis no longer around (render and the > view function have returned).  All that's left is the rendered representation. > > I see

Re: Using ModelForm to edit ManyToMany in both directions?

2010-03-29 Thread Thierry Chich
Nice idea ! It will simplify my work. Thanks to share it ! Le 28 mars 2010 à 22:29, "pjrhar...@gmail.com" a écrit : See this snippet: http://www.djangosnippets.org/snippets/1295/ Peter On Mar 27, 6:02 am, jwils2...@gmail.com wrote: I believe the answer is to

Re: How to customize admin's save button functionality?

2010-03-29 Thread vikalp sahni
You can override a method called "save_model" inside your model admin class, this will be called whenever you hit save button of admin for a particular class. You can write your custom logic in this method. ex def save_model(self, request, obj, form, change): Your Logic Regards,

Re: Displaying the fields of two tables on the same admin page

2010-03-29 Thread Gramware
On Mar 29, 7:56 am, Asim Yuksel wrote: > Sorry for not making it clear. The idea is to use default admin > template and help the admin to enter data from admin interface. I will > enter data via admin's default template. Lets say I have People and > Publications Table

Adding records to 2 tables at the same time from admin page

2010-03-29 Thread cnone
The admin page has a button to add records. When I click a table from admin page and click add, I can enter data. What I want to do is I want to add records to 2 table at the same time. The admin page will show me all the fields to enter data for both table. When I click save the data will be

Django Sum all values with a distinct ForeignKey ID & zip them with fields from related table

2010-03-29 Thread Gramware
I would like to perform something similar to http://stackoverflow.com/questions/861310/summing-the-values-from-the-2nd-table-based-on-id-of-the-1st-table (ie get the sum of distinct event amounts in a payment table then group the payments by event details and total money paid for them. Also