Re: How to display a _unicode_ string when involving a many to many relationship?

2010-03-31 Thread Daniel
return u', '.join(self.facet.all()) does not work. I believe from Dive into Python .join expects a String: "join works only on lists of strings; it does not do any type coercion. Joining a list that has one or more non-string elements will raise an exception." But in the Python docs it says .

Re: How do I properly unit test a Django session?

2010-03-31 Thread Phlip
adambossy wrote: > My problem is that I am trying to _write_ session variables before > calling my view. For example: Django really falls down here, especially compared to Brand X. Stuff a session like this: def assemble_session(self, dictionary): from django.conf import settings

Re: form object has no attribute 'cleaned_data'

2010-03-31 Thread Nick Arnett
On Wed, Mar 31, 2010 at 9:09 PM, jeff wrote: > >page_title='Add a Pair' >if request.method == 'POST': >form=SymForm(request.POST) >if form.is_valid: is_valid is a call - you want this: if form.is_valid(): Nick -- You received this message beca

form object has no attribute 'cleaned_data'

2010-03-31 Thread jeff
so i've searched high and low on this error. lots of answers about having used old versions of django. i did this: j...@earth:/home/samba/raymour/v1/rrsite$ django-admin.py --version 1.1.1 then a lot of stuff about python path having been done with an easy installer and having an 'egg' in it. doe

Re: Getting strange email from "dreamhost"

2010-03-31 Thread Wiiboy
Hehe, that's kinda funny...Thanks for your help Russell. =) -- 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.

Re: Getting strange email from "dreamhost"

2010-03-31 Thread Russell Keith-Magee
On Thu, Apr 1, 2010 at 7:55 AM, Russell Keith-Magee wrote: > On Wed, Mar 31, 2010 at 11:13 PM, Wiiboy wrote: >> Hi guys, >> I've gotten two emails from "Mail Delivery Subsystem >> " with the subject "Your message was NOT >> received by django-us...@googlegroups.com!". >> The body is below.  Anyon

admin inline objects: replicated insertions on first save

2010-03-31 Thread nate_hardy
hi all, i'm building an application that models the literature, biology and ecology of a group of insects. i have been playing around with the admin site and have noticed some odd behavior. For example, I have a class for species names, that has several inline model objects in the admin - one for

Re: ckeditor and ckfinder

2010-03-31 Thread Bobby Roberts
thanks for your reply... your tip got me thinking and I found the docs at: http://docs.cksource.com/CKFinder/Developers_Guide/PHP/CKEditor_Integration under manual integration On Mar 31, 10:16 pm, Sam Lai wrote: > On 1 April 2010 13:05, Bobby Roberts wrote: > > > I'm trying to get ckfinder

Re: ckeditor and ckfinder

2010-03-31 Thread Sam Lai
On 1 April 2010 13:05, Bobby Roberts wrote: > I'm trying to get ckfinder to integrate with ckeditor.  I can go > directly to the ckfinder sample standalone and it uploads to the right > directory and everything so I know that ckfinder is configured > properly... anyone know how to get the upload t

ckeditor and ckfinder

2010-03-31 Thread Bobby Roberts
I'm trying to get ckfinder to integrate with ckeditor. I can go directly to the ckfinder sample standalone and it uploads to the right directory and everything so I know that ckfinder is configured properly... anyone know how to get the upload tab on the image popup with ckeditor so that ckfinder

Re: Getting strange email from "dreamhost"

2010-03-31 Thread Russell Keith-Magee
On Wed, Mar 31, 2010 at 11:13 PM, Wiiboy wrote: > Hi guys, > I've gotten two emails from "Mail Delivery Subsystem > " with the subject "Your message was NOT > received by django-us...@googlegroups.com!". > The body is below.  Anyone know why I'm getting these?  Is anyone else > getting them?  I ha

Re: Table in models.py not being created during syncdb

2010-03-31 Thread Russell Keith-Magee
On Thu, Apr 1, 2010 at 1:16 AM, wchildsuk wrote: > Hi, > > I'm using the django app, django-schedule (http://github.com/thauber/ > django-schedule) and am adding an additional table to map users to > calendars (see line 253 on dpaste).  When I run syncdb it completely > ignores my table and doesn'

Re: Select previous and next from a table

2010-03-31 Thread Vinicius Mendes
I know how to do this with 3 queries: object = Model.objects.filter(pk=pk) previous = Model.objects.filter(votes__lt=object.votes).order_by('-votes')[:1][0] next = Model.objects.filter(votes__gt=object.votes).order_by('votes')[:1][0] My only problem with this is if there is any object with the sa

Re: JOIN instead of multiple SELECT

2010-03-31 Thread Rolando Espinoza La Fuente
On Wed, Mar 31, 2010 at 5:22 PM, Federico Capoano wrote: > Thanks, > > how many things i've learnt today, to optimize the number and length > of query by using: > > * select_related > * only > * extra > > Do you think the performance gain is worth the work? Yes. Specially in loops where you have:

Select previous and next from a table

2010-03-31 Thread x13
Hello, I'm trying to figure out a simple way to get a known record from a database but also get the "previous" and "next" records too. My model is a Photo table with user's votes : ID Votes 1 24 2 5 3 102 4 21 5 10 So, if I query for the photo with ID=4 (21 votes) I'd like

Re: JOIN instead of multiple SELECT

2010-03-31 Thread Federico Capoano
Thanks, how many things i've learnt today, to optimize the number and length of query by using: * select_related * only * extra Do you think the performance gain is worth the work? And I've a curiosity more to ask: If I use the cache framework, once the results are cached the will the database

Re: How to display other field(not the foreign key) in admin dropdown list

2010-03-31 Thread Asim Yuksel
Okey I want to answer this :) just add a unicode method to your model something like this def __unicode__(self): return "%s" % self.name On 31 Mart, 16:37, Asim Yuksel wrote: > I have a people table and a bridge table which are related. bridge > table has a foreignkey field for people ta

Re: JOIN instead of multiple SELECT

2010-03-31 Thread Rolando Espinoza La Fuente
On Wed, Mar 31, 2010 at 3:30 PM, Federico Capoano wrote: > Hello to all, > > has been a while i've been wondering how to optimize Django's queries > to the database, for example by setting it to use JOIN to retrieve > foreign keys instead of multiple selects. > > for example if I have a blog objec

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

2010-03-31 Thread Asim Yuksel
The people and publication are not related so I cant use manytomany On 31 Mart, 15:30, "Giovannetti, Mark" wrote: > > 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 th

How to display other field(not the foreign key) in admin dropdown list

2010-03-31 Thread Asim Yuksel
I have a people table and a bridge table which are related. bridge table has a foreignkey field for people table. When I click add from django admin it shows the peopleid in a drop down list. What I want to do is I want to show the people.name field instead of peopleid foreignkey field? How can I

JOIN instead of multiple SELECT

2010-03-31 Thread Federico Capoano
Hello to all, has been a while i've been wondering how to optimize Django's queries to the database, for example by setting it to use JOIN to retrieve foreign keys instead of multiple selects. for example if I have a blog object that has a category foreign key and I write in a template {{ blog.c

Re: How to display a _unicode_ string when involving a many to many relationship?

2010-03-31 Thread Daniel Roseman
On Mar 31, 8:26 pm, Daniel wrote: > Hi guys, > > I'd appreciate a little advice on the following: > > I'm trying to get a unicode string representation of my model named > Sample.  But that Sample model has a many to many relationship with > another model, Facet. > > So Sample's unicode method: >

Re: How do I properly unit test a Django session?

2010-03-31 Thread adambossy
Thierry, Thanks for the response and the code sample. To be clear, the "variables" in accounts/accueil/ are session variables? I assume your view for that URL looks like this: def accueil(request): ... request.session['domaine'] = Domaine.objects.get(nom='DomaineAdmin') .

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

2010-03-31 Thread Giovannetti, Mark
> > 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

How to display a _unicode_ string when involving a many to many relationship?

2010-03-31 Thread Daniel
Hi guys, I'd appreciate a little advice on the following: I'm trying to get a unicode string representation of my model named Sample. But that Sample model has a many to many relationship with another model, Facet. So Sample's unicode method: def __unicode__(self): retu

Re: Passing hidden foreign key to form as initial value

2010-03-31 Thread phoebebright
Final approach: in the forms.py excluded the courses foreign key field in models.py made courses blank and nullable didn't pass any initial values to the form in the view, saved the form like this: item = Courses.objects.get(pk=whatever) obj = form.save(commit=False)

Re: Probably a very basic data modeling question

2010-03-31 Thread Daniel
Hi everyone, I am still having issues with my data models. I can't tell if the underlying problem is my model definitions or my inability to do the queries to manipulate my models to get the output that I want. Could someone please tell me if this is the right way to do it in my models.py? Agai

Re: Getting strange email from "dreamhost"

2010-03-31 Thread creecode
Hello all, I just posted a reply to a message here via the web interface and got an email like this. Toodle-lo.. creecode -- 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...@goo

Re: "format" error with django-piston

2010-03-31 Thread Brandon Taylor
I ended up using jezdez's fork of Piston, and it works as expected: https://bitbucket.org/jezdez/django-piston/ On Mar 31, 9:57 am, Brandon Taylor wrote: > Hi everyone, > > I know there's a Google Group for django-piston, but there's not very > much conversation on that group, so I'm re-posting h

Re: RPC4Django - can't pass Boolean args nor Keyword args

2010-03-31 Thread creecode
Apparently the question has been answered. On Mar 31, 1:51 am, Simone Orsi wrote: > anyone using RPC4Django has faced > thishttps://bugs.launchpad.net/rpc4django/+bug/552437? Toodle-loo. creecode -- You received this message because you are subscribed to the Google Groups "D

Table in models.py not being created during syncdb

2010-03-31 Thread wchildsuk
Hi, I'm using the django app, django-schedule (http://github.com/thauber/ django-schedule) and am adding an additional table to map users to calendars (see line 253 on dpaste). When I run syncdb it completely ignores my table and doesn't through any errors. Can anyone shed any light on way it mig

Re: Is it possible to change the width of the boxes displayed by the filter_horizontal in Django admin interface?

2010-03-31 Thread rc
Walt, Thanks for the clarification. That helped a lot. I did get this working. Yeah! Had to do a slight tweak to the surrounding elements on the page to get it to look right (minor change to widgets.css). Now I can see all of the data for the profiles. Seems like there should be a way to auto scal

Re: Admin Add Page

2010-03-31 Thread Asim Yuksel
Thanks but I get error when I try to extend it it says:Caught an exception while rendering: opts and it highlights {% submit_row %} Any ideas? On 31 Mart, 11:23, Brandon Taylor wrote: > You can extend the change_form.html and change_list.html templates for > those views, or the base_s

Re: Admin Add Page

2010-03-31 Thread Brandon Taylor
You can extend the change_form.html and change_list.html templates for those views, or the base_site.html template. Look in your: django/contrib/admin/templates/admin/ folder to see all of the templates. Also, check out the documentation at: http://docs.djangoproject.com/en/dev/ref/contrib/admin/#

Re: Getting strange email from "dreamhost"

2010-03-31 Thread Vinicius Mendes
I getting those too. __ Vinícius Mendes Solucione Sistemas http://solucione.info/ On Wed, Mar 31, 2010 at 12:14 PM, Brandon Taylor wrote: > I'm getting those from this forum as well. > > On Mar 31, 10:13 am, Wiiboy wrote: > > Hi guys, > > I've gotten two emails from "Mail D

Re: word processing django apps

2010-03-31 Thread Brandon Taylor
At The Texas Tribune (texastribune.org), we use a combination of TinyMCE and django-reversion. It doesn't track changes between versions, but it maintains a history table of each previous version of our main content types. Cheers, Brandon On Mar 30, 4:18 pm, John Griessen wrote: > Some potential

Re: Passing hidden foreign key to form as initial value

2010-03-31 Thread phoebebright
Brandon, Thanks for your suggestion. I tried passing it an ID, but as you say, I also have to override the save. What I don't understand is why it does it fine if the form includes the foreign key in a popup? They are both passing back integers after all. Also failed to get the save method worki

Re: transactions

2010-03-31 Thread Tomasz Zieliński
On 31 Mar, 06:04, Continuation wrote: > On Mar 30, 8:33 am, Tomasz Zieliñski > > wrote: > > If you take a look at TransactionMiddleware source: > > >http://code.djangoproject.com/browser/django/tags/releases/1.1.1/djan... > > > then you'll see that it's just commit_on_success in disguise: > > >

Re: Getting strange email from "dreamhost"

2010-03-31 Thread Brandon Taylor
I'm getting those from this forum as well. On Mar 31, 10:13 am, Wiiboy wrote: > Hi guys, > I've gotten two emails from "Mail Delivery Subsystem > " with the subject "Your message was NOT > received by django-us...@googlegroups.com!". > The body is below.  Anyone know why I'm getting these?  Is an

Getting strange email from "dreamhost"

2010-03-31 Thread Wiiboy
Hi guys, I've gotten two emails from "Mail Delivery Subsystem " with the subject "Your message was NOT received by django-us...@googlegroups.com!". The body is below. Anyone know why I'm getting these? Is anyone else getting them? I have no affiliation with Dreamhost or at all, so this is...stra

Re: display user.email in a custom model

2010-03-31 Thread Wiiboy
Hmm, you should be able to do that. I do exactly that in one of my models. The only I differences I see between yours and mine is that you return a unicode string, rather than just a string, and you wrote self.user, rather than self.user.something. -- You received this message because you are s

Re: modelform validation

2010-03-31 Thread Vinicius Mendes
Test if self.instance.user is not None, if so, change the queryset to exclude the self.instance.user: http://gist.github.com/350440 __ Vinícius Mendes Solucione Sistemas http://solucione.info/ On Wed, Mar 31, 2010 at 11:24 AM, Emanuel wrote: > Hi all! > > I have a modelfor

Re: modelform validation

2010-03-31 Thread Brandon Taylor
Hi there, When calling def clean_name(self):, you can see if your instance has an id or not: def clean_name(self): if not self.id: #this would be a new record else: #this would be an existing record HTH, Brandon On Mar 31, 9:24 am, Emanuel wrote: > Hi all! > > I have a

Re: Passing hidden foreign key to form as initial value

2010-03-31 Thread Brandon Taylor
Hi there, Instead of using the course object in your initial data, which will pass in the __unicode__ representation of the object, pass in the id: form = CouseBook(initial = {'course': course.id}) That should get you the numeric id, but you'll also need to override your save method to get the c

"format" error with django-piston

2010-03-31 Thread Brandon Taylor
Hi everyone, I know there's a Google Group for django-piston, but there's not very much conversation on that group, so I'm re-posting here as well. I'm getting an error when running the "blogserver" example site included with Piston: AttributeError at /api/posts/ 'Blogpost' object has no attribu

Re: Error in image upload while copying file

2010-03-31 Thread pjmorse
On Mar 30, 10:53 am, bruno desthuilliers wrote: > Uh. Oh, well - then you indeed have a problem :( > Hum... Is that legacy code ? Looks pretty ugly to me - wouldn't pass a > code review here. > Well, assuming you're using at least Django 1.0, I suggest you get rid > of this mess and make appropri

modelform validation

2010-03-31 Thread Emanuel
Hi all! I have a modelform and I want to customize validation. I'm overriding the method clean_(). When I'm saving the form I want to see if a specific user has been already assigned to a project. The only way he can ben assigned again is if he's an inactive user, so: models.py Class User(mod

script to import hotmail contacts with python hotmail contacts api

2010-03-31 Thread Karthikeyan P
can anybody tell me how to write a script to import hotmail contacts with windowslivelogin.py library,i have a web based script used for django environment below: from lib.WindowsLiveLogin import ConsentToken import urllib, urllib2 def hotmail_login(request): wll = WindowsLiveLogin(appid= sett

Re: Model field default value and form field weirdness

2010-03-31 Thread Michel Thadeu Sabchuk
> The problem is that this expanding of callables are done on > "formfield" method of the field class and this method is called in the Sorry by this email guys, I just found a ticket talking about it: http://code.djangoproject.com/ticket/11940 It seems the problem is fixed. Thanks! -- Michel

modelform validation

2010-03-31 Thread Emanuel
Hi all! I have a modelform and I want to customize validation. I'm overriding the method clean_(). When I'm saving the form I want to see if a specific user has been already assigned to a project. The only way he can ben assigned again is if he's an inactive user, so: models.py Class User(mod

Model field default value and form field weirdness

2010-03-31 Thread Michel Thadeu Sabchuk
Hi guys, I'm working on a cms running over django1.1.1 and I'm facing a weird problem. I have a BlogPost model that uses a callable (datetime.datetime.now) as default value for some field. I created my own views for manage blog posts. The view make use of a BlogPostForm ModelForm class, defined

Hotmail contacts using python library

2010-03-31 Thread karthi
can anybody tell me how to write a script to import hotmail contacts with windowslivelogin.py library,i have a web based script used for django environment brlow: from lib.WindowsLiveLogin import ConsentToken import urllib, urllib2 def hotmail_login(request): wll = WindowsLiveLogin(appid=sett

Hotmail contacts using python hotmail sdk

2010-03-31 Thread karthi
i have the SDK with me, source code for getting hotmail contacts in DJANGO environment: -- from lib.WindowsLiveLogin import ConsentToken import urllib, urllib2 def hotmail_login(request): wll = WindowsLiveLogin(appi

Passing hidden foreign key to form as initial value

2010-03-31 Thread phoebebright
Displayed fields resolve as expected, hidden fields cause errors. This works: in the model CourseBook has a foreign key to Course In the view: course = Course.objects.get(pk=whatever) form = CouseBook(initial = {'course': course}) in the Form: class CourseBook(ModelForm): class Meta:

Re: auth.Message ignores directions from database router - Possible RelatedManager bug

2010-03-31 Thread Russell Keith-Magee
On Mon, Mar 29, 2010 at 9:28 AM, xin wrote: > I am unsure if this a bug in Django, or django-multidb-router, or > something I've done wrong. > > I'm using django-multidb-router from here: > http://github.com/jbalogh/django-multidb-router > With two database definitions, a read_only_user and a rea

Apache hang-up after booting

2010-03-31 Thread Josh B
Hi everybody, I'm using django (integrated in an application, omero) as a production server with mod_python (v3.3.1-147.35) and apache (v2.2.10-2.8.1). Unfortunately after rebooting the server apache seems to hang-up. When opening the website I just see the progress-indicator gif. When restarting

after except IntegrityError no database values are returned anymore

2010-03-31 Thread mendes.rich...@gmail.com
Dear Django Users, There is a part in my code where i check if there is an IntegrityError on certain values and is so the error is caught and saved in a list. To be able to do this i imported from psycopg2 the IntegrityError. This all does work like it should the only thing is that after that i c

rpc4django - passing keyword arguments or boolean arguments

2010-03-31 Thread Simone Orsi
Hi, anybody using rpc4django has faced this? https://bugs.launchpad.net/rpc4django/+bug/552437 Cheers, SimO -- 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 fro

RPC4Django - can't pass Boolean args nor Keyword args

2010-03-31 Thread Simone Orsi
Hi, anyone using RPC4Django has faced this https://bugs.launchpad.net/rpc4django/+bug/552437 ? Cheers, SimO -- 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

Re: How do I properly unit test a Django session?

2010-03-31 Thread Thierry Chich
Le mercredi 31 mars 2010 05:40:43, adambossy a écrit : > The behavior of Django sessions changes between "standard" views code > and test code, making it unclear how test code is written for > sessions. Googling this yields two relevant discussions about this > issue: > > 1. "Easier manipulation o

display user.email in a custom model

2010-03-31 Thread Alfredo Alessandrini
Hi, I've this model: -- class Person(models.Model): user = models.ForeignKey(User) Can I display the user.email or user.first_name in the admin site administration? I try this: --- def __unicode__(self): return u"%s %s" % (self.u

Re: How can i populate app engine(production environment) database with local sdk database

2010-03-31 Thread Eximius
Please help me out On Mar 29, 11:04 pm, Eximius wrote: > Hi all, > I have created a django application using app engine sdk, and have > stored data in database using forms. But the problem i am getting when > i deploy it, the data I stored is not there in the app engine > datastore. > So how