Re: django template strange behavior

2011-04-14 Thread Jason Culverhouse
You can use the template language to test against what you think are constants, the parser is actually testing 2 "literals". The parser tests for 2 literals with names 'None' and 'False'. When parser tries to resolve these in the context a VariableDoesNotExist exception is thrown and both object

Re: URLs in error messages from form validation

2011-04-25 Thread Jason Culverhouse
On Apr 25, 2011, at 5:39 AM, Kane Dou wrote: > * Daniel Gerzo [2011-04-25 13:07:46 +0200]: > >> On 25.4.2011 12:40, Kane Dou wrote: >>> * Daniel Gerzo [2011-04-24 17:52:13 +0200]: >>> Hello all, say I have a following form: class MyForm(forms.Form): id = for

Re: Overwriting the handler404

2011-05-02 Thread Jason Culverhouse
On May 1, 2011, at 8:01 AM, doniyor wrote: > Hi there, > i am trying to overwrite handler404 of django so that i can call my > own view function when it doesnot find the appropriate view and if it > tries to give Http404. the whole problem is as follows: > > i defined my view function called 're

Re: Email app is breaking long lines, any fix?

2011-05-05 Thread Jason Culverhouse
On May 5, 2011, at 5:50 PM, John Crawford wrote: > I'm using the filebased email backend for testing (although the console > version had the same problem). When I send email, either via function or > template, lines that are too long, are broken, with an '=' sign at the end. > For instance: >

Re: django-voting : How to get objects with number of votes.

2011-05-06 Thread Jason Culverhouse
On May 6, 2011, at 8:35 AM, Shawn Milochik wrote: > Sorry, I was going off of your pasted code. > > Sounds like this could be a case for annotate. > http://docs.djangoproject.com/en/1.3/ref/models/querysets/#annotate > > I recommend reading this whole page, along with the two prerequisite pages

Re: How do you apply a decorator to all views in a views.py file?

2011-05-10 Thread Jason Culverhouse
On May 10, 2011, at 12:50 PM, Shawn Milochik wrote: > I have a decorator I'd like to apply to every view in a given views.py file. > Is there an elegant way to do that in Django? > > I searched Google and the docs but didn't find anything. > > So, I wrote some code which works and demonstrates

Re: Getting "most"

2011-05-27 Thread Jason Culverhouse
django.contrib.contenttypes.models import ContentType for object in most: foo = ContentType.objects.get(id= object['content_type']).get_object_for_this_type(object['object_id']) You can also see https://github.com/coleifer/django-generic-aggregation This will get you clo

Re: save out a test database?

2011-05-29 Thread Jason Culverhouse
On May 29, 2011, at 7:13 PM, Margie Roginski wrote: > Anyone know if there is a way to save out a test database that is > created through the django TestCase module? > I think this gets you close: https://docs.djangoproject.com/en/1.2/ref/django-admin/#testserver-fixture-fixture django-admin

Re: tuple comparison to make one tuple

2011-06-08 Thread Jason Culverhouse
//docs.python.org/library/itertools.html#recipes You could use unique_everseen, still creates a set, but might be useful if you intention is only to iterate through the remaining list. # overkill for example... tuple(unique_everseen(chain(t1, t2, t3))) ('a...@b.com', 'b...@b.com', &#x

Django 1.2.5 postgres autocommit and contenttype sites tests failures

2011-03-01 Thread Jason Culverhouse
Hi, It seems that the contenttype framework and the sites contribs conflict with using the autocommit:True database option. I'm not really sure what happens but here is a simple test case that shows that the order of the tests causes a failure. It looks like from the SQL that the save point is be

Re: What apps or snippets to use for Facebook and Twitter registration, login and posting?

2011-03-02 Thread Jason Culverhouse
On Mar 2, 2011, at 8:28 AM, Rodrigo Cea wrote: > I am developing a site that I want to link with Facebook and Twitter. > > So as to not reinvent the wheel, I'm looking for apps or snippets that can > help with this, specifically: > > 1) allow users to register and login with their Facebook and

Re: django remove unicode from query result ?

2011-03-10 Thread Jason Culverhouse
On Mar 10, 2011, at 5:26 PM, sushanth Reddy wrote: > I using jplot in my app .if list is in unicode(u) ,it not displaying the > charts,thats the reason i want to remove it ... > Pass a json string then have the Java(?) side convert it back into "objects" In [1]: import json In [2]: json.dumps

Re: Error on aggragate function-Count

2011-03-11 Thread Jason Culverhouse
On Mar 11, 2011, at 5:02 AM, pols wrote: > hai > I have two models as shown belove > > from django.db import models > from django.db.models import Sum > # Create your models here. > class polls(models.Model): > question = models.CharField(max_length=200) > pubish_date = models.DateTime

Re: request.user.save() doesnt work

2011-03-11 Thread Jason Culverhouse
On Mar 11, 2011, at 10:46 AM, Daniel Roseman wrote: > On Thursday, March 10, 2011 11:59:15 PM UTC-8, Ndungi Kyalo wrote: > Hi guys. Am using django non-rel on appengine. I am using django's > auth backend for my authentication, since I did not want to have to > force my users to use gmail login

Re: How to use extra to count based on the value of a field?

2011-03-16 Thread Jason Culverhouse
On Mar 16, 2011, at 8:49 AM, Margie Roginski wrote: > Hmmm ... so I just got back to trying this and I actually don't think > the annotate call as suggested does what I am looking for. Say I want > to annotate queues with the number of closed tasks. This call: > > Queue.objects.filter(task__sta

Re: Django projects, apps, and git repos

2011-03-17 Thread Jason Culverhouse
Ben, You should a have a look at https://github.com/bueda/django-boilerplate "django-boilerplate is an attempt to set up a standard convention for Django app layouts, to assist in writing utilities to deploy such applications. A bit of convention can go a long way." It's very similar to what yo

Re: Multiple INNER JOIN without raw SQL

2011-03-18 Thread Jason Culverhouse
On Mar 18, 2011, at 6:38 AM, Ricardo F. Teixeira wrote: > Hi everyone! > > Without using raw SQL queries how can I make multiple joins using this > model? > Do a search for "django select_related reverse one to many" for some alternatives > I'm trying to get something like this: > > SELECT

Re: Postgresql transaction error

2011-03-22 Thread Jason Culverhouse
On Mar 22, 2011, at 10:03 AM, cootetom wrote: > I'm using the psycopg2 python library and have tried postgresql 8 and > now 9. > > The error, in brief, is: > > " > Template error > In template c:\python26\lib\site-packages\django\contrib\admin > \templates\admin\base.html, error at line 58 > Caug

Re: sorting in /admin

2011-03-22 Thread Jason Culverhouse
On Mar 22, 2011, at 12:10 PM, Bobby Roberts wrote: > how else would you pull in information from another model into the > current model list view in admin? > > There are some options: Search for http://www.google.com/search?q=ModelAdmin+__ You'll find http://code.djangoproject.com/ticket/10743

Re: sorting in /admin

2011-03-22 Thread Jason Culverhouse
> On Tue, Mar 22, 2011 at 5:29 PM, Jason Culverhouse > wrote: > On Mar 22, 2011, at 12:10 PM, Bobby Roberts wrote: > > > how else would you pull in information from another model into the > > current model list view in admin? > > > > > Ther

Re: Error installing permissions superuser when a userprofile has been defined

2011-03-23 Thread Jason Culverhouse
On Mar 23, 2011, at 4:25 AM, Malcolm Box wrote: > Further investigation: looks like it's a South/syncdb interaction. The > UserProfile will be created by the south migration, but of course that > hasn't run when the auth post_install runs to prompt for a superuser. > > Sadly syncdb --migrate doe

Re: Exclude results with ManyToManyField

2011-03-23 Thread Jason Culverhouse
On Mar 23, 2011, at 12:19 PM, Julien Castets wrote: > Hello, > > from django.contrib.auth.models import User > > class Team(models.Model): > users = models.ManyToManyField(User) > > > I would like to retrieve every User in my database who does not belong > to a team. Left outer join is you

Re: check for existence in bulk

2011-03-30 Thread Jason Culverhouse
On Mar 30, 2011, at 9:47 AM, Calvin Spealman wrote: > I think your best bet is > > MyModel.objects.filter(some_field__in=ok_values).count() == len(ok_values) > > On Wed, Mar 30, 2011 at 12:44 PM, dmitry b wrote: >> Hi, >> >> is there a way to check in bulk for record existence and get back a

Re: How to filter the list_display in the django admin with the request.session[user_id]

2011-03-30 Thread Jason Culverhouse
On Mar 30, 2011, at 2:31 PM, Pablo Vidal wrote: > I need to know how to filter in the django admin model License, the > licenses of the user logged-in to the admin. > > class License(models.Model): >user = models.ForeignKey('wiki.User') >name = models.CharField(max_length = 100) > >

Re: staticfile app question

2011-03-30 Thread Jason Culverhouse
On Mar 30, 2011, at 4:50 PM, Mike Ramirez wrote: > On Wednesday, March 30, 2011 04:20:32 pm Shawn Milochik wrote: >> I have the exact same problem. I hope there is a solution, because >> good site design often results in image references in the CSS. > > I think you guys are over analyzing the

Re: staticfile app question

2011-03-30 Thread Jason Culverhouse
On Mar 30, 2011, at 5:10 PM, Mike Ramirez wrote: > On Wednesday, March 30, 2011 05:01:08 pm Jason Culverhouse wrote: >> On Mar 30, 2011, at 4:50 PM, Mike Ramirez wrote: >>> On Wednesday, March 30, 2011 04:20:32 pm Shawn Milochik wrote: >>>> I have the exact s

Re: south for django

2011-03-31 Thread Jason Culverhouse
On Mar 31, 2011, at 1:18 PM, jay K. wrote: > > I think i found the source of all problems > > I am not a python expert, so I was wondering if anybody can tell me what this > code means > > // beginning of code > > from django.db import models > > > class TranslationForeignKey(models.Foreig

Re: Navigation menu

2011-04-12 Thread Jason Culverhouse
There is a snippet http://djangosnippets.org/snippets/1729/ "Template tag to handle navigation item selection" which is quite useful for creating navigation/menu structure Jason On Apr 12, 2011, at 11:43 AM, javatina wrote: > You can put your current menu option in context and then, while > rende