Re: How to list_filter by a foreign key field not returned by the model's __unicode__?

2009-04-25 Thread TiNo
On Sat, Apr 25, 2009 at 10:34 PM, kspr wrote: > # This is what I want: (admin.py) > class DoctorAdmin(admin.ModelAdmin): >list_filter = ['origin.country'] > shouldn't it be: list_filter = ['origin__country'] TiNo --~--~-~--~~~---~--~~

How to list_filter by a foreign key field not returned by the model's __unicode__?

2009-04-25 Thread kspr
Hi Djangoers! I'm making a database system which holds information about doctors and what universities they got their degree from. It consists of two models, Doctor and Origin. In Doctor, I make a field, origin, which is a ForeignKey to Origin, surprisingly :-) The Origin model has a name of

How to list_filter by a foreign key field not returned by the model's __unicode__?

2009-04-25 Thread kspr
Hi Djangoers! I'm making a database system which holds information about doctors and what universities they got their degree from. It consists of two models, Doctor and Origin. In Doctor, I make a field, origin, which is a ForeignKey to Origin, surprisingly :-) The Origin model has a name of

Re: Manipulating ManyToManyField in Model.save()

2009-04-25 Thread Malcolm Tredinnick
On Sat, 2009-04-25 at 04:37 -0700, medhat wrote: > Here is a small example: > > class Item(models.Model): > title = models.CharField(max_length=25) > other = models.TextField(null=True, blank=True) > items = models.ManyToManyField('self', null=True, blank=True) > > def

Re: ManyToMany relationship being 'lost'?

2009-04-25 Thread Malcolm Tredinnick
On Fri, 2009-04-24 at 15:32 -0300, Rubens Altimari wrote: > Hello, > > > Sorry if this is a known issue, but I didn't find anything elsewhere. > > > I have these two models related by a many-to-many relationship. I'm > using the 'default' admin application to edit data, and in order to be >

Re: Offtopic: MySQL or PostgreSQL for a limited VPS ?

2009-04-25 Thread Malcolm Tredinnick
On Fri, 2009-04-24 at 16:18 -0700, Joshua Partogi wrote: > > > On Apr 25, 8:20 am, Konstantin S wrote: > > Hello! > > > > I am planning to deploy django based site on a limited VPS and want to > > know which database is more suitable for this ? If I've had a 'normal' > >

Google Appengine patch and Apengine Helper

2009-04-25 Thread Lakshman Prasad
I see 2 different django projects for porting django app to app-engine http://code.google.com/p/app-engine-patch/ http://code.google.com/p/google-app-engine-django/ I'd like to know the preferred module to use and the relative benefits and problems. Thanks in advance. -- Regards, Lakshman

Re: limit number of many to one relationships for an entity

2009-04-25 Thread Malcolm Tredinnick
On Thu, 2009-04-23 at 22:05 -0700, Avi wrote: > is there a neat way to inform the admin interface that you want to > limit hte number of one to many relationships ? (i..e. only allow 3 > addresse entires per person) ? If "neat" means "just a simple option", then no, since that's not really a

Re: Prolem dealing with json post data

2009-04-25 Thread Malcolm Tredinnick
On Thu, 2009-04-23 at 21:23 -0700, Francis wrote: > Hi, I'm using dojo (also tried with jquery) to send json data to my > django application. > > But I can't get it working properly. The trick to understanding is to think how are you sending the data? In particular, what MIME type is being

Re: m2m trouble when referencing "self"

2009-04-25 Thread Alex Gaynor
On Sat, Apr 25, 2009 at 6:26 PM, Tim Valenta wrote: > > Hello all. I tried the IRC, but it's too chaotic and not enough > people take you seriously :) > > Very very abbreviated example code: > > class Person(models.Model): >parents = models.ManyToManyField('self',

m2m trouble when referencing "self"

2009-04-25 Thread Tim Valenta
Hello all. I tried the IRC, but it's too chaotic and not enough people take you seriously :) Very very abbreviated example code: class Person(models.Model): parents = models.ManyToManyField('self', related_name='children') Now, the exact relationship is just an example, but it

Re: Is there a bug in queryset distinct() filtration in Postgre SQL?

2009-04-25 Thread Malcolm Tredinnick
On Thu, 2009-04-23 at 13:22 -0700, Tyler Erickson wrote: > I seem to be encountering the same or similar issue. The distinct() > method seems to have no affect on my queryset. Both this post and the original one don't contain enough information for anybody to replicate the problem (since we can

Re: help beginner: problem with settings.py conf and urls.

2009-04-25 Thread Daniel Roseman
On Apr 25, 7:33 pm, zayatzz wrote: > Hello > > Im trying to give enough information in first post so you could help > me if you can or want to. For that reason this post might turn out bit > long. > > I found tinymce pluggable for django

Re: [Querysets] Trying to determine status of an order based on the properties of its order items

2009-04-25 Thread Malcolm Tredinnick
On Thu, 2009-04-23 at 11:00 +0100, Andrew Ingram wrote: > Hi All, > > I'm looking for an efficient way to solve the following problem, I'm > happy to use custom sql if necessary. > > Basically I have an Order model and an OrderItem model (ecommerce > site), structured as follows: > >

Re: inclusion tag optional argument

2009-04-25 Thread Malcolm Tredinnick
On Tue, 2009-04-21 at 11:51 -0700, adrian wrote: > > I want to have an inclusion tag that builds a menu system, which has a > default config. > > default_config = [list of dicts here] > > @register.inclusion_tag('_nav_leftmenu.html') > def nav_leftmenu(menu_config=default_config): > #

Re: dynamic creation of models

2009-04-25 Thread Malcolm Tredinnick
On Tue, 2009-04-21 at 09:52 -0700, David De Sousa wrote: > Hi! in a new project, I have the necessity of creating new models on > the fly, and then interact with them (including writing to a new table > in the database), is there any way of doing this? Yes. > I'm guessing that with a little

Re: How to relate child instance to Parent?

2009-04-25 Thread Malcolm Tredinnick
On Mon, 2009-04-20 at 22:39 +1000, Joshua Partogi wrote: > Dear all, > > I have an inheritance model as such: > > class User(models.Model) > > class Staff(User) > > Now I already have the instance of User inside view: > > user = User.objects.create(name="Joe") > > now how do I relate this

Re: Database Error

2009-04-25 Thread Malcolm Tredinnick
On Sun, 2009-04-19 at 22:24 -0700, Adrián Ribao wrote: > Hello, > I have a model using extra fields in M2M relationships as described > in: > http://docs.djangoproject.com/en/dev/topics/db/models/#extra-fields-on-many-to-many-relationships > > When I try to do something I get this: > >

Re: Block delete

2009-04-25 Thread Malcolm Tredinnick
On Fri, 2009-04-17 at 21:36 -0700, koranthala wrote: [...] > I understand it is done because all backends does not support it - but > can it be supported for backends which actually support it? I am using > postgresql - and now I have to do many non-optimal things to decrease > this query count.

django-filebrowser

2009-04-25 Thread cu3edweb
I am trying to install django-filebrowser and I followed all the steps I thought but when I am in the admin section and I click the filebrowser link I get this error: OSError at /admin/filebrowser/ (2, 'No such file or directory') Request

Re: Strange inconsistency between SQL and ORM with SQLite.

2009-04-25 Thread Malcolm Tredinnick
On Thu, 2009-04-16 at 23:11 -0700, Tai Lee wrote: > I'm trying to add an extra selection to a queryset, `featured`, which > should be True (or 1) if the primary key matches a number of known > values. > > It appears to work as expected both in SQL and the ORM when matching > against a single

Re: Query exclude in and selective sort questions

2009-04-25 Thread Malcolm Tredinnick
On Thu, 2009-04-16 at 18:20 -0700, Thierry wrote: > Let's say I have a list of words in my database: > > ['bbb', 'aaa', 'zzz', 'ddd'] > > How can I retrieve a list of the above excluding the following words > ['aaa', 'zzz'] by using __in? I can do the above with: > >words_list =

help beginner: problem with settings.py conf and urls.

2009-04-25 Thread zayatzz
Hello Im trying to give enough information in first post so you could help me if you can or want to. For that reason this post might turn out bit long. I found tinymce pluggable for django - http://code.google.com/p/django-tinymce/ - and ive been trying to implement it. following instructions

Re: Java-doc style api docs.

2009-04-25 Thread Malcolm Tredinnick
On Wed, 2009-04-15 at 15:42 -0700, Eddified wrote: > Are there up-to-date java-doc style api docs like this: > http://djangoapi.matee.net/ > anywhere on the official django site? I've looked high and low and > can't find it... No. They don't exist there. Intentionally. If anybody wants that

Re: Django DB strange behavior

2009-04-25 Thread Aaron Lee
Thanks James and Karen, Yes indeed it was the problem, I updated the my.cnf to have transaction_isolation set to READ-COMMITTED and it works fine now. Is there any benefit of this approach of the other (connection autocommit) i.e. performance-wise ? -Aaron On Sat, Apr 25, 2009 at 7:24 AM, Karen

Re: Models.py - retrieve information from other models via ForeignKey field?

2009-04-25 Thread Malcolm Tredinnick
This doesn't seem to have been resolved at all, so a couple of questions that might help things out... On Tue, 2009-04-14 at 19:06 -0700, Emma F wrote: > I feel like there must be something very elementary that I'm missing > here, but I've been all through the documentation and can't figure it >

Re: admin area language settings

2009-04-25 Thread Alex Gaynor
On Sat, Apr 25, 2009 at 11:23 AM, Ramiro Morales wrote: > > On Sat, Apr 25, 2009 at 11:51 AM, RunThePun wrote: > > > > Howdy dj-users, > > > > I'm running a pinax site which is strictly in hebrew, I disabled the > > locale middleware so my LANGUAGE_CODE

Re: Polymodels and datastore layout - one big table?

2009-04-25 Thread tommytastic
yes my bad!! wrong group - apologies On Apr 25, 4:04 pm, Karen Tracey wrote: > On Sat, Apr 25, 2009 at 11:57 AM, Tom Howe wrote: > > > 'm trying to take advantage of polymodel inheritance and curious to > > get opinion of pro/cons of using a datastore

Re: Is Django the Right Choice?

2009-04-25 Thread Carmine Paolino
Il giorno 24/apr/09, alle ore 17:53, Karen Tracey ha scritto: > So where is the persistent storage of this XML data? Always in a > file on the client (is there only one client?), and POSTed to the > server each time a client wants to run a query on the data? If so: > why even have a

Re: Polymodels and datastore layout - one big table?

2009-04-25 Thread Karen Tracey
On Sat, Apr 25, 2009 at 11:57 AM, Tom Howe wrote: > > 'm trying to take advantage of polymodel inheritance and curious to > get opinion of pro/cons of using a datastore model that is essentially > one big table > As polymodel is an Google App Engine thing and not in

Polymodels and datastore layout - one big table?

2009-04-25 Thread tommytastic
'm trying to take advantage of polymodel inheritance and curious to get opinion of pro/cons of using a datastore model that is essentially one big table My datastore layout is starting to look like this: class BaseModel(polymodel.PolyModel, search.SearchableModel): created =

Polymodels and datastore layout - one big table?

2009-04-25 Thread Tom Howe
'm trying to take advantage of polymodel inheritance and curious to get opinion of pro/cons of using a datastore model that is essentially one big table My datastore layout is starting to look like this: class BaseModel(polymodel.PolyModel, search.SearchableModel): created =

Re: Django on Google app engine

2009-04-25 Thread Karen Tracey
On Sat, Apr 25, 2009 at 10:58 AM, dartdog wrote: > > I'd also add that the Django project had it's last release in Aug 08 > and the App engine Patch is being actively worked on almost daily. > This statement is rather unclear. The "Django project" sounds like Django

Re: Best practise on using Django forms in jQuery UI modal dialogue.

2009-04-25 Thread Chris Dew
Thanks, I'll give it a try. On 25 Apr, 15:14, cschams wrote: > You could try Thickbox, which has a modal mode, and supports iframed > and ajax content. Its almost a drop-in replacement for links to modal > dialogues and it degrades to simple

Re: admin area language settings

2009-04-25 Thread Ramiro Morales
On Sat, Apr 25, 2009 at 11:51 AM, RunThePun wrote: > > Howdy dj-users, > > I'm running a pinax site which is strictly in hebrew, I disabled the > locale middleware so my LANGUAGE_CODE would take precedence when users > come to the site. > > The problem is that django-admin

Re: Django on Google app engine

2009-04-25 Thread dartdog
I'd also add that the Django project had it's last release in Aug 08 and the App engine Patch is being actively worked on almost daily. On Apr 25, 3:13 am, Joshua Partogi wrote: > Hi Filip, > > Thanks for the long explanation. It saves me time to mess around with > App

admin area language settings

2009-04-25 Thread RunThePun
Howdy dj-users, I'm running a pinax site which is strictly in hebrew, I disabled the locale middleware so my LANGUAGE_CODE would take precedence when users come to the site. The problem is that django-admin is alot better in English, but I get it in Hebrew. Is there any way to configure the

Re: Django on Google app engine

2009-04-25 Thread dartdog
Actually you can download a sample app with App-Engine Patch and be up and going very quickly, using non-ported apps is more problematic... But also moving forward at a fair pace. Google's lack of support for certain key features in the datastore are a real issue like lack of full text search...

Re: How can I get the user ID of the currently logged-in user?

2009-04-25 Thread Daniel Strasser
> So request.user.id will give you the userid of the currently loggedin user. aaah. thank you very much! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: How can I get the user ID of the currently logged-in user?

2009-04-25 Thread TiNo
You can find the user object in the request: http://docs.djangoproject.com/en/dev/ref/request-response/#django.http.HttpRequest.user So request.user.id will give you the userid of the currently loggedin user. Tino On Sat, Apr 25, 2009 at 4:44 PM, Daniel Strasser

How can I get the user ID of the currently logged-in user?

2009-04-25 Thread Daniel Strasser
Hey I have been searching for a while for this, but I didn't came to a solution. I use the Django Authentication framework. In a view, I have: def settings(request): cust = Customer.objects.get(???) return render_to_response('useraccount/settings.html', {'loggedin':

Re: Django DB strange behavior

2009-04-25 Thread Karen Tracey
On Sat, Apr 25, 2009 at 5:07 AM, Aaron Lee wrote: > Today I just stumble upon a very strange bug and I am not sure if that's > Django bug or not. > > Here's the context: > I have a model Job which has a status field. > > For debugging, I run python manage.py shell and do > >

Re: how to display m2m fields in template

2009-04-25 Thread adrian
Thanks. A related question - how would I tell the template to display only one address, say the address which has address.address_type='P' I can do it the laborious way which is to get all, loop, and then use {% ifequal %} to display the one I want. But then I have to pass a variable

Re: Best practise on using Django forms in jQuery UI modal dialogue.

2009-04-25 Thread cschams
You could try Thickbox, which has a modal mode, and supports iframed and ajax content. Its almost a drop-in replacement for links to modal dialogues and it degrades to simple links. http://jquery.com/demo/thickbox/ On Apr 25, 12:39 am, Chris Dew wrote: > I'd like to use

Re: get and display html from another site

2009-04-25 Thread Karen Tracey
On Sat, Apr 25, 2009 at 4:30 AM, keegan3d wrote: > > Im building a site that uses wordpress for the blog, and django for > everything else. I want to be able to pull in some html from the blog. > > So far if I get the html with urllib2 and then pass the response to >

Re: What Postgresql driver does Django use? Async API?

2009-04-25 Thread Kenneth Gonsalves
On Saturday 25 April 2009 17:07:59 Continuation wrote: > What Postgresql driver does Django use? psycopg -- regards kg http://lawgon.livejournal.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users"

Re: What Postgresql driver does Django use? Async API?

2009-04-25 Thread James Bennett
On Sat, Apr 25, 2009 at 7:37 AM, Continuation wrote: > What Postgresql driver does Django use? This question is answered by Django's documentation, which covers the database adapter modules used by each of the built-in database backends. > And does it support the async

Re: Decimal to Decimal nightmare

2009-04-25 Thread Graham Dumpleton
On Apr 25, 10:06 pm, Newt wrote: > Thank you very much, > yes, it's the only app (well I have a production and development > version of the same application running there). > The production version is dj 1.0.2 > The development version is dj 1.1b - with the trunk

Re: Django DB strange behavior

2009-04-25 Thread James Bennett
On Sat, Apr 25, 2009 at 5:07 AM, Aaron Lee wrote: > So is there some InnoDB specific thing in Django that does some "smart" > caching? Unless you explicitly enable Django's caching system, and explicitly make use of it, Django does no caching of any sort whatsoever.

Archive - Generic Views

2009-04-25 Thread Bobo
Hi all, I'm working on a Django project where I've ran into some difficulties. I've a message archive where I (and the admins) can post a message to the regular users of the page. Because there come more and more messages I want to build a archive for them, just like en blog, where it's

Re: Decimal to Decimal nightmare

2009-04-25 Thread Newt
Thank you very much, yes, it's the only app (well I have a production and development version of the same application running there). The production version is dj 1.0.2 The development version is dj 1.1b - with the trunk version of django- pyodbc - but I switched to this version in desperate

What Postgresql driver does Django use? Async API?

2009-04-25 Thread Continuation
What Postgresql driver does Django use? And does it support the async API ( http://www.postgresql.org/docs/8.3/static/libpq-async.html ) of postgresql? Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Manipulating ManyToManyField in Model.save()

2009-04-25 Thread medhat
Here is a small example: class Item(models.Model): title = models.CharField(max_length=25) other = models.TextField(null=True, blank=True) items = models.ManyToManyField('self', null=True, blank=True) def __unicode__(self): return self.title def save(self,

Re: Decimal to Decimal nightmare

2009-04-25 Thread Graham Dumpleton
Presuming you are only running the one web application on the server, do things improve it you add directive: PythonInterpreter main_interpreter to Apache configuration. If it doesn't, not the same issue as pyscopg2. Graham On Apr 25, 9:13 pm, Newt wrote: > I'm

Re: Decimal to Decimal nightmare

2009-04-25 Thread Newt
I'm running it as mod_python on Ubuntu 8.04 server. I connect to external MSSQL server thru django-pyodbc, the only thing I had to install manually was the pyodbc, the rest was installed using package manager (unix-odbc, freetds). I'm not much a server admin and it was a few months ago. Ales

Re: Decimal to Decimal nightmare

2009-04-25 Thread Graham Dumpleton
On Apr 25, 12:37 am, Newt wrote: > Hello, > > in my latest application I have models with like 15 Decimal fields, > with different decimal places. > > when I try to save an object of that model, I get sometimes (often, > but not always) this error: > >   File

Re: Decimal to Decimal nightmare

2009-04-25 Thread Newt
Hi, I'm pretty sure I use it correctly, but don't understand how this fixes the problem :(. I looked up the reload in the documentation and all it does a module reload - where would I place it? I was thinking i could convert all decimals to strings prior the saving the new object, but it would

Implementing Dry principle through Validators in Django 1.0.x

2009-04-25 Thread Harish
Hi Folks, I have implemented a simple custom validator. Here i am pasting the Code model.py --- from django.db import models from django.contrib import admin from django import forms class Personal(models.Model): firstName = models.CharField( max_length = 20, blank =

Re: get and display html from another site

2009-04-25 Thread Joshua Partogi
On Apr 25, 6:30 pm, keegan3d wrote: > Im building a site that uses wordpress for the blog, and django for > everything else. I want to be able to pull in some html from the blog. > > So far if I get the html with urllib2 and then pass the response to > render_to_response it

Django DB strange behavior

2009-04-25 Thread Aaron Lee
Today I just stumble upon a very strange bug and I am not sure if that's Django bug or not. Here's the context: I have a model Job which has a status field. For debugging, I run python manage.py shell and do jobs = Job.objects.filter(status__in=['A']) *I am using MySQL 5.0 InnoDb* Re-running

get and display html from another site

2009-04-25 Thread keegan3d
Im building a site that uses wordpress for the blog, and django for everything else. I want to be able to pull in some html from the blog. So far if I get the html with urllib2 and then pass the response to render_to_response it gets formatted to print as a string, -> div Is there a way to

Re: Django on Google app engine

2009-04-25 Thread Joshua Partogi
Hi Filip, Thanks for the long explanation. It saves me time to mess around with App Engine :-) Based on your explanation, it seems that using django on Appengine doesn't really get you anywhere. Thanks again. On Apr 24, 7:06 pm, kRON wrote: > Basically, you can't

From example models, how to highlight relation in Template

2009-04-25 Thread Almost George
I have (essentially) the following models: class AttendanceRelation(models.Model): event = models.ForeignKey('swingtime.Occurrence') attendee = models.ForeignKey('AttendeePerson') class AttendeePerson(models.Model): first_name= models.CharField(blank=False, max_length=100)