Re: variable tag / filter

2008-10-23 Thread ramya
I wanted to write one all purpose generic template.. Now I have split that and extended multiple specific templates.. :( Thanks, ~ramyak/ On Oct 23, 6:34 pm, Jeff FW <[EMAIL PROTECTED]> wrote: > To my knowledge, no, it's not possible to do that. Even if it was, > however, I would strongly

Re: Problem with contrib.comments and signals: instance is not defined

2008-10-23 Thread Malcolm Tredinnick
On Thu, 2008-10-23 at 21:23 -0700, Brandon Taylor wrote: > Hi everyone, > > I'm using Django 1.0, and attempting to do some comment moderation > with Akismet. When I try to wire up a pre_save signal, I'm getting an > error saying 'instance' is not defined. Here is my code: > > def

Re: variable tag / filter

2008-10-23 Thread ramya
I wanted to write one all purpose generic template.. Now I have split that and extended multiple specific templates.. :( Thanks, ~ramyak/ On Oct 23, 6:34 pm, Jeff FW <[EMAIL PROTECTED]> wrote: > To my knowledge, no, it's not possible to do that. Even if it was, > however, I would strongly

Problem with contrib.comments and signals: instance is not defined

2008-10-23 Thread Brandon Taylor
Hi everyone, I'm using Django 1.0, and attempting to do some comment moderation with Akismet. When I try to wire up a pre_save signal, I'm getting an error saying 'instance' is not defined. Here is my code: def moderate_comment(sender, **kwargs): if not instance.id: # <-- instance is not

Re: variable tag / filter

2008-10-23 Thread ramya
I wanted to write one all purpose generic template.. Now I have split that and extended multiple specific templates.. :( Thanks, ~ramyak/ On Oct 23, 6:34 pm, Jeff FW <[EMAIL PROTECTED]> wrote: > To my knowledge, no, it's not possible to do that. Even if it was, > however, I would strongly

Re: UnicodeDecodeError when Unicode is used in view

2008-10-23 Thread Malcolm Tredinnick
On Thu, 2008-10-23 at 23:14 -0400, Chuck Bai2 wrote: > I have a contact form which send email. It is working fine. But when I try to > add two Unicode to subject line: > > subject = "DOMAIN.COM 留言 - %s (%s)" % (full_name,location) The string portion of this (the "DOMAIN.COM ..." bit) is not a

UnicodeDecodeError when Unicode is used in view

2008-10-23 Thread Chuck Bai2
I have a contact form which send email. It is working fine. But when I try to add two Unicode to subject line: subject = "DOMAIN.COM 留言 - %s (%s)" % (full_name,location) I got the following error message: UnicodeDecodeError at /contact_us/ 'ascii' codec can't decode byte 0xe7 in position

Re: Different settings.py files for server and development

2008-10-23 Thread D. Woodman
Thanks Ned! Cheers On Thu, Oct 23, 2008 at 7:08 PM, Ned Batchelder <[EMAIL PROTECTED]>wrote: > And BTW, my bad. Change the except: line to except ImportError, then the > syntax error from the dash will be apparent in your 500 page. > > --Ned. > http://nedbatchelder.com > > > Ned Batchelder

Re: ViewDoesNotExist: Even though it does

2008-10-23 Thread Dj Gilcrease
On Thu, Oct 23, 2008 at 7:20 PM, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > > On Wed, 2008-10-22 at 00:09 -0700, JonathanB wrote: >> Getting a very erratic Exception: >> >> ViewDoesNotExist: Could not import supplier.views. Error was: cannot >> import name Buyer My guess is something in

Re: Different settings.py files for server and development

2008-10-23 Thread Ned Batchelder
And BTW, my bad. Change the except: line to except ImportError, then the syntax error from the dash will be apparent in your 500 page. --Ned. http://nedbatchelder.com Ned Batchelder wrote: > settings-custom isn't a valid Python file name, because a Python > identifier can't have a dash in it.

Re: Different settings.py files for server and development

2008-10-23 Thread Ned Batchelder
settings-custom isn't a valid Python file name, because a Python identifier can't have a dash in it. Use an underscore. --Ned. http://nedbatchelder.com Dana wrote: > Ned/Felix, > > Ok, I tried your guys solution but it does not seem to be working for > me, so Im wondering where I goofed. > >

Re: django.contrib.comments and returning to the original object

2008-10-23 Thread Brandon Taylor
Found the solution. I can pass in: request.GET, which contains a QueryDict object containing the 'c' variable for the comment. Hope this helps someone! Brandon On Oct 23, 8:50 pm, Brandon Taylor <[EMAIL PROTECTED]> wrote: > Hi everyone, > > I'm using 1.0 and have added contrib.comments to my

django.contrib.comments and returning to the original object

2008-10-23 Thread Brandon Taylor
Hi everyone, I'm using 1.0 and have added contrib.comments to my project which has a blog. I can preview a comment just fine, but I would like to provide a way for the user to get back to the original blog entry once they've posted their comment. Out of the box, comments get redirected after

Re: What do you use for design interface / mockup

2008-10-23 Thread Francis
I prefer not to use software like photoshop or gimp, mainly because I'm no graphic designer. What I want to do is to design layout, forms and presentation. To find the most 'user friendly' interface and to have a clear picture of my application before writing any code. Then the graphic artist

Re: How to set length of db_index for CharFields?

2008-10-23 Thread Malcolm Tredinnick
On Thu, 2008-10-23 at 09:08 -0700, new_user wrote: > In MySQL CREATE INdex there is such a parameter 'length'. Actually I > need to make index just on first letters of the words. > Thanks. You'll need to do it manually or using the "initial SQL" option (see the documentation for details on

Re: Disable i18n for certain templates

2008-10-23 Thread Malcolm Tredinnick
On Tue, 2008-10-21 at 10:07 -0700, Armandas wrote: > Hi, > > I am using internationalization on my project. Recently I found out > that output from date filter is not in english. The point is, that I > use this to construct pubDate for my rss, like this: > > {{ post.date|date:"D, d M Y H:i:s"

Re: ViewDoesNotExist: Even though it does

2008-10-23 Thread Malcolm Tredinnick
On Wed, 2008-10-22 at 00:09 -0700, JonathanB wrote: > Getting a very erratic Exception: > > ViewDoesNotExist: Could not import supplier.views. Error was: cannot > import name Buyer > > What is stage is Buyer (model Class) does exist and the exception is > only thrown once in a while. I'll

Re: Named URLs for Flatpages?

2008-10-23 Thread Malcolm Tredinnick
On Tue, 2008-10-21 at 14:14 -0700, erikcw wrote: > Hi all, > > I'm working on a project that uses flatpages pretty heavily. I was > wondering if there was a way to use named urls with flatpages so that > I can use reverse() in my other views and {% url flat_privacy_policy > %} in my templates.

Re: variables in forms.py?

2008-10-23 Thread Malcolm Tredinnick
On Sun, 2008-10-19 at 11:37 -0700, Jorge Romo wrote: > Hell guys, I have this little doubt: > > I want to validate a form, but it has several different options. It > has to take a value_a and the see if it is bigger, smaller or equal to > another value_b. The issue (or maybe not :p) is that the

Re: filter OR for results...

2008-10-23 Thread Malcolm Tredinnick
On Mon, 2008-10-20 at 01:29 +0300, Erik Allik wrote: > CollegeTeam.objects.filter(team=game.team1) | > CollegeTeam.objects.filter(team=game.team2) That's certainly possible, but it's marginally more heavyweight than doing it at the filter level (but only a tiny bit). > But I would instead

Re: Cache and upload handlers .. fun times!

2008-10-23 Thread Malcolm Tredinnick
On Sun, 2008-10-19 at 13:24 -0700, truebosko wrote: > Hi there, > > So I spent the last few hours trying to get a ProgressBar Upload > handler working > > What it does: User uploads a file, when they hit the submit button, > javascript is called and begins polling the server (a django view)

Re: Inherited classes and generic views - curiosity.

2008-10-23 Thread Malcolm Tredinnick
On Sun, 2008-10-19 at 12:29 -0700, Scott SA wrote: > When passing a QuerySet of objects which inherit part of their model > from another class, generic views only seems to respond to the parent > class: > > Here's a simplified example: > > class ParentClass(models.Model): > name_last =

Re: save_model and how to ignore any changes to an object

2008-10-23 Thread Malcolm Tredinnick
On Sun, 2008-10-19 at 10:21 -0700, Markos Gogoulos wrote: > hi all. When I edit an object on django admin and press save, I want > the object NOT to be saved, but instead create another object that > contains any changes (I want to be able to review it later). So the > original object has to be

Re: QuerySet extra() duplicate table

2008-10-23 Thread Malcolm Tredinnick
On Fri, 2008-10-17 at 21:03 -0700, Rares Vernica wrote: > Hello, > > I am using QuerySet "extra()" function. For the "tables" parameter I > need to specify the same table multiple times, so I included an alias > for each table. Unfortunately Django quotes the table names and > everything is

Re: Promote a Place to a Restaurant?

2008-10-23 Thread Malcolm Tredinnick
On Fri, 2008-10-17 at 11:47 +0200, Erik Stein wrote: > > Hello -- > > I could not get an answer on the IRC channel and I'm also not finding > the right keywords for a successful search on the subject[1]: > > You all know the model inheritance example with the classes Place and >

Re: Different settings.py files for server and development

2008-10-23 Thread Dana
Never mind, answered my own problem. I had a missing setting that was causing a 500 error before it could access the settings-custom.py. Your solutions worked! Thanks! On Oct 23, 5:18 pm, Dana <[EMAIL PROTECTED]> wrote: > Ned/Felix, > > Ok, I tried your guys solution but it does not seem to be

Re: Different settings.py files for server and development

2008-10-23 Thread Dana
Ned/Felix, Ok, I tried your guys solution but it does not seem to be working for me, so Im wondering where I goofed. Here is what ive got My settings.py and settings-custom.py file are here: config/ settings.py settings-custom.py The directory containing config is on the PythonPath,

Re: Different settings.py files for server and development

2008-10-23 Thread Ned Batchelder
In settings.py: try: from settings_local import * except: pass --Ned. http://nedbatchelder.com Dana wrote: > Hello everyone, > > I know a form of this question has been asked before on this group but > I can't for the life of me find the thread. > > I am wondering how

Date Format in Admin

2008-10-23 Thread Botolph
I would like to change the formatting of dates in the admin from - MM-DD to DD-MM-. I have set "DATE_FORMAT" in the settings file, but that only changes list_display and not the DateField input. In a post from Januar 2007 Adrian wrote: > Yes, newforms DateFields let you specify the input

Re: What do you use for design interface / mockup

2008-10-23 Thread Peter Herndon
At the risk of being flamed, I'd say that nothing is better than OmniGraffle. That aside, both Gimp and Dia are cross-platform and very reasonable choices. They may not fit the Mac gui, but they work well enough if cross-platform is a higher priority than best-of-breed. You can get the job

Re: Different settings.py files for server and development

2008-10-23 Thread Dana
Sweet, I knew it was simple :) Thanks! On Oct 23, 3:54 pm, felix <[EMAIL PROTECTED]> wrote: > at the very bottom of settings.py : > > from local_settings import * > > this overwrites just the imported keys/values > > -flx > > On Thu, Oct 23, 2008 at 11:55 PM, Dana <[EMAIL PROTECTED]> wrote: > >

Re: Different settings.py files for server and development

2008-10-23 Thread felix
at the very bottom of settings.py : from local_settings import * this overwrites just the imported keys/values -flx On Thu, Oct 23, 2008 at 11:55 PM, Dana <[EMAIL PROTECTED]> wrote: > > Hello everyone, > > I know a form of this question has been asked before on this group but > I can't for

Different settings.py files for server and development

2008-10-23 Thread Dana
Hello everyone, I know a form of this question has been asked before on this group but I can't for the life of me find the thread. I am wondering how I can have a generic settings.py file that contains all my basic settings and then have a settings-local.py (or whatever...) and have that

Limit Number Of User Sessions

2008-10-23 Thread [EMAIL PROTECTED]
Hi, I was wondering if there is a way to limit the number of sessions a user can have open using the authentication middleware django provides? In other words I would like django to end the current session when the user logs in using another computer. I am developing a subscription based

Default values/prepopulate fields in ModelAdmin add view

2008-10-23 Thread Delta20
I want to be able to use the standard/auto-generated admin add form, but need to put default values in the fields. Is this possible? Basically I want to do something like this in a view: 1: def some_view(request, ... ): 2: ... 3: values = { 'title': t, 'author': a } 4: admin =

Re: from mysite.polls.models import Poll, Choice

2008-10-23 Thread bruno desthuilliers
On 23 oct, 21:30, "James Bennett" <[EMAIL PROTECTED]> wrote: > On Thu, Oct 23, 2008 at 1:47 PM, bruno desthuilliers > > <[EMAIL PROTECTED]> wrote: > > It's indeed a pretty bad idea to refer to the project name in import > > statements (as well as in a couple other places too FWIW), and I > >

Re: Setting up Django on CentOS5 with flup and fastcgi

2008-10-23 Thread [EMAIL PROTECTED]
thanks for all the suggestions... I've managed to to kinda get it working with flup and fcgi although i'm not quite there yet. Here is my file structure and my fcgi file. public file path = /home/xxx/www/projectblah/ application file path = /home/xxx/django_projects/projectblah_files/

Re: Following tutorial but can't get something

2008-10-23 Thread gryzzly
Thanks for the help. I've been screwed up with myself cuz I've created SOME templates folders during making some tutorials. Anyway, thanks for the help! On Oct 23, 3:27 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Thu, Oct 23, 2008 at 4:00 AM, gryzzly <[EMAIL PROTECTED]> wrote: > > > It

Custom include tag to parse locale into filename

2008-10-23 Thread Gerard Petersen
Hi All, I have an include tag to a file with context help information. My app is fully i18n-ed, but I don't want to handle the bigger the helptext via i18n because of its size. I want to end up with something like this: myapp/customer_side.en.html. The code snippet: {% include

Re: Foreign key with tons of items

2008-10-23 Thread Lars Stavholm
Fabio Natali wrote: > Fabio Natali wrote: > [...] >> class Prod2(models.Model): >> name = models.CharField(max_length=30) >> >> class Prod1(models.Model): >> name = models.CharField(max_length=30) >> belongs_to = models.ForeignKey(Prod2) >> >> class Prod0(models.Model): >> name =

Re: from mysite.polls.models import Poll, Choice

2008-10-23 Thread James Bennett
On Thu, Oct 23, 2008 at 1:47 PM, bruno desthuilliers <[EMAIL PROTECTED]> wrote: > It's indeed a pretty bad idea to refer to the project name in import > statements (as well as in a couple other places too FWIW), and I > defnitively fail to understand why it's documented that way. It's documented

Re: from mysite.polls.models import Poll, Choice

2008-10-23 Thread bruno desthuilliers
On 23 oct, 11:14, tak <[EMAIL PROTECTED]> wrote: > Hi, > > I am following the tutorial. One part I get confusion is the import > statement including the project name. I am referring the last example > of 1st tutorial. It's indeed a pretty bad idea to refer to the project name in import

Re: Python Script bugs.

2008-10-23 Thread bruno desthuilliers
On 23 oct, 19:48, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hello everyone, > I would like to know what isn't good in my script. A couple things here and there. But there's also something wrong with your whole post: there's nothing Django-related in it. Python-related questions belongs

Re: Foreign Key Problem

2008-10-23 Thread bruno desthuilliers
On 23 oct, 19:53, cwurld <[EMAIL PROTECTED]> wrote: > Hi, (snip) > > When I run syncdb, the table is created (I can see it with MySQL > Admin), but I get the following error: > > > C:\Documents

Need help with mod python

2008-10-23 Thread R C
HELP PLEASE I keep getting this error: MOD_PYTHON ERROR ProcessId: 29055 Interpreter:'mysite.com' (this has been changed by me) ServerName: 'mysite.com' DocumentRoot: '/var/www/' URI:'/admin' Location: '/' Directory: None Filename:

Foreign Key Problem

2008-10-23 Thread cwurld
Hi, I have been using django for about a year and a half. It has been great. My hat is off to all the developers. I am trying to port my project to django 1.0 for 0.97. I am using MySQL. The ported version seems to be working well. The problem is that am trying to add a new model that contains

Re: Django Model design: OOP or Database-centric approach?

2008-10-23 Thread dustpuppy
Thanks Kip. I appreciate the suggestions. Kind regards, Cormac. On Oct 23, 4:29 pm, Kip Parker <[EMAIL PROTECTED]> wrote: > Neither seem right to me. I'm not quite sure what the application > does, but it seems likely that a person only belongs to one family, in > which case you'll need a

Python Script bugs.

2008-10-23 Thread [EMAIL PROTECTED]
Hello everyone, I would like to know what isn't good in my script. #!/usr/bin/python # -*- coding: iso-8859-15 -*- from time import strftime import datetime t = input(datetime.date) global t print t.strftime("Day %w of the week a %A . Day %d of the month (%B). ") print t.strftime("Day %j of the

Re: Foreign key with tons of items

2008-10-23 Thread Fabio Natali
Fabio Natali wrote: [...] > class Prod2(models.Model): > name = models.CharField(max_length=30) > > class Prod1(models.Model): > name = models.CharField(max_length=30) > belongs_to = models.ForeignKey(Prod2) > > class Prod0(models.Model): > name = models.CharField(max_length=30)

Foreign key with tons of items

2008-10-23 Thread Fabio Natali
Hi everybody. In my admin page I have a field for a foreign key with hundreds of items. That results in a drop down menu which is very difficult and annoying to use. This is my models.py: class Prod2(models.Model): name = models.CharField(max_length=30) class Prod1(models.Model): name

Re: What do you use for design interface / mockup

2008-10-23 Thread Gerard Petersen
Francis, I'm not a designer but I start my global layout on paper or in my head and then it's (x)html and CSS. The first thing that comes to mind on doing this electronically is photoshop (and siblings ... CS3?). And the Gimp but that would not be a good choice on OSX (gui handling wise).

Re: Permissions in template tags

2008-10-23 Thread dougeven
Something like this should work... from django import template import datetime class CurrentTimeNode(template.Node): def __init__(self, format_string): self.format_string = format_string def render(self, context): # apply appropriate permissions for this tag user

Implementing a search function for a django-powered site

2008-10-23 Thread Giles Thomas
Hi there, I'm building a new section for our website and am having great fun doing it in Django! The aim is to let people upload documents, tag them, rate them, etc. Obviously one important aspect of this is searching, and I'm wondering how best to do that. I've googled around to see if

Re: Where is my Django?

2008-10-23 Thread leonel
Maicon Da Silva wrote: > Hi every body... first sorry for my english! that's because i'm > uruguaian(a little country between Brasil and Argentina) > > That is my problem: > > I have installed Django 0.96 from Synaptic in Ubuntu 8.04 and i don't > find de directory 'django' in site-packages on

Re: dynamic upcast

2008-10-23 Thread Carl Meyer
Hi harold, On Oct 23, 9:27 am, dadapapa <[EMAIL PROTECTED]> wrote: > If by "save a derived object from a parent instance" you mean that > the method that saves the object is defined in the parent class, > than this should not cause a problem, since type(self) will > dynamically identify the

Re: model help.

2008-10-23 Thread Niall Mccormack
Thanks for that - and yes I am in a bit of a rush! I thought my initial question was maybe a little to convoluted as I just needed a lead to go on really... On 23 Oct 2008, at 16:13, Karen Tracey wrote: > On Thu, Oct 23, 2008 at 10:45 AM, Niall Mccormack <[EMAIL PROTECTED] > > wrote: > >

Re: Where is my Django?

2008-10-23 Thread Maicon Da Silva
Thankyou so much man! i find it! On 23 oct, 14:20, David Reynolds <[EMAIL PROTECTED]> wrote: > On 23 Oct 2008, at 5:17 pm, Maicon Da Silva wrote: > > > > > Hi every body... first sorry for my english! that's because i'm > > uruguaian(a little country between Brasil and Argentina) > > > That is

Re: Where is my Django?

2008-10-23 Thread David Reynolds
On 23 Oct 2008, at 5:17 pm, Maicon Da Silva wrote: > > Hi every body... first sorry for my english! that's because i'm > uruguaian(a little country between Brasil and Argentina) > > That is my problem: > > I have installed Django 0.96 from Synaptic in Ubuntu 8.04 and i don't > find de directory

Where is my Django?

2008-10-23 Thread Maicon Da Silva
Hi every body... first sorry for my english! that's because i'm uruguaian(a little country between Brasil and Argentina) That is my problem: I have installed Django 0.96 from Synaptic in Ubuntu 8.04 and i don't find de directory 'django' in site-packages on /usr/lib/python2.5/site- packages or

How to set length of db_index for CharFields?

2008-10-23 Thread new_user
In MySQL CREATE INdex there is such a parameter 'length'. Actually I need to make index just on first letters of the words. Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to

Re: Exception thrown from django.test.client.Client

2008-10-23 Thread Karen Tracey
On Thu, Oct 23, 2008 at 11:41 AM, [EMAIL PROTECTED] < [EMAIL PROTECTED]> wrote: > > By using pdb post mortem, I found out that the request.META dictionary > doesn't actually have 'REMOTE_ADDR' in it. Settings.INTERNAL_IPS is > '127.0.0.1'. So then get() returns None, and the error comes from >

Re: Confused by select_related()

2008-10-23 Thread Karen Tracey
On Thu, Oct 23, 2008 at 11:21 AM, AndyB <[EMAIL PROTECTED]> wrote: > > Apologies for not using DPaste. I thought the snippets were small > enough. And I thought my question was cleared than it turned out to > be! > I wasn't saying what you posted would have been better at dpaste.com, what you

What do you use for design interface / mockup

2008-10-23 Thread Francis
Hi, What do you use for design interface / mockup? I made some search, omnigraph seems pretty popular. But I often switch between linux and Mac and omnigraffle isn't cross platform. Is there any tools out there that work on Mac OS X and Linux? (or something better than omnigraffle) Thank you

Django 1.0: XML documents in database, view as HTML, download as RTF

2008-10-23 Thread Mirto Silvio Busico
Hi all django gurus, There is any hint, snippet, google code related to the object? Use case: * publish an online magazine with content saved as XML inside the database * every article is shown as a web page (so in HTML) * there should be an download magazine function that

Re: Exception thrown from django.test.client.Client

2008-10-23 Thread [EMAIL PROTECTED]
By using pdb post mortem, I found out that the request.META dictionary doesn't actually have 'REMOTE_ADDR' in it. Settings.INTERNAL_IPS is '127.0.0.1'. So then get() returns None, and the error comes from python trying to evaluate None in '127.0.0.1'. Should the test client be setting this value?

Re: Django Model design: OOP or Database-centric approach?

2008-10-23 Thread Kip Parker
Neither seem right to me. I'm not quite sure what the application does, but it seems likely that a person only belongs to one family, in which case you'll need a foreign key like this. class Adult(models.Model): name = models.CharField(maxlength=30) partner =

Re: Confused by select_related()

2008-10-23 Thread AndyB
Apologies for not using DPaste. I thought the snippets were small enough. And I thought my question was cleared than it turned out to be! To clarify (where someobject_set is a related-object queryset): someobject_set.all().query.as_sql() someobject_set.select_related().query.as_sql() Both show

Add more details into history

2008-10-23 Thread Low Kian Seong
Dear all, I want to extend django's history function to show more information about activities inside the admin interface. I want to add in the detail of what is the original value of a field that has been changed and the value that it has been changed into. Can someone tell which part of django

Re: Confused by select_related()

2008-10-23 Thread Karen Tracey
On Thu, Oct 23, 2008 at 10:44 AM, AndyB <[EMAIL PROTECTED]> wrote: > > >>> p.residentialunitmix_set.all().query.as_sql() > > (u'SELECT `tbl_ResidentialUnitMix`.`id`, > `tbl_ResidentialUnitMix`.`Planning-id`, > `tbl_ResidentialUnitMix`.`quantity`, > `tbl_ResidentialUnitMix`.`Bedrooms`,

Re: geodjango: installation comments.

2008-10-23 Thread Justin Bronn
On Oct 18, 2:21 pm, "Jorge Vargas" <[EMAIL PROTECTED]> wrote: > I did found some inconsistencies on the docs I'll like to point out: > 1- the different installation docs use a methodology with little > changes, probably due to being written by different people. it will be > nice to unify them

Re: model help.

2008-10-23 Thread Niall Mccormack
ok, I'm going to simplify my question. is there any way that I can create a ForeignKey or a ManytToMany that can accept multiple types of data Models? On 23 Oct 2008, at 11:34, Niall Mccormack wrote: > > Hi there, > > I'm learning Django at the moment and need some advice. > > I need to

Confused by select_related()

2008-10-23 Thread AndyB
>>> p.residentialunitmix_set.all().query.as_sql() (u'SELECT `tbl_ResidentialUnitMix`.`id`, `tbl_ResidentialUnitMix`.`Planning-id`, `tbl_ResidentialUnitMix`.`quantity`, `tbl_ResidentialUnitMix`.`Bedrooms`, `tbl_ResidentialUnitMix`.`Type`, `tbl_ResidentialUnitMix`.`Tenure` FROM

Re: Accidentally creating a model with "def unicode(self):" will crash django with no stack trace

2008-10-23 Thread Brian
I should be more precise. :) Here's a simplified excerpt of the problematic code - when a Django (1.0) template tries to turn it into text with its default unicode function, Python (2.5.1) crashes (on Mac OS X 10.5): from django.db import models from people import Person class

Re: Problem when visit admin site for add a new item with manytomanyfield

2008-10-23 Thread Karen Tracey
On Thu, Oct 23, 2008 at 5:48 AM, IL <[EMAIL PROTECTED]> wrote: > > from django.db import models > > class Song(models.Model): >name = models.CharField(max_length = 50, unique = True) >lyricBy = models.CharField(max_length = 10, null = True, blank = > True) >coSinger =

Re: Mercurial or Git

2008-10-23 Thread Justin Bronn
On Oct 22, 2:54 pm, Rit Lim <[EMAIL PROTECTED]> wrote: > which one is the Django community moving toward to, mercurial or git? I would say the most popular among Django core developers is git. I use mercurial (with hgsvn), and Gary Wilson uses bazaar. Personally, I chose mercurial because I

Re: Following tutorial but can't get something

2008-10-23 Thread Karen Tracey
On Thu, Oct 23, 2008 at 4:00 AM, gryzzly <[EMAIL PROTECTED]> wrote: > > It is self-expalnatory, but the problem is that I do have a template > file. And it is there. > You're saying you have a file named: /home/misha/www/djcode/templates/polls/results.html ? Are you sure you have that exact

Re: How to use PythonOption DjangoPermissionName in apache authentication?

2008-10-23 Thread Eric
I've got the answer the permission format used in DjangoPermissionName is in my example, it's 'main.printdriver_developer' On Oct 22, 11:56 pm, Eric <[EMAIL PROTECTED]> wrote: > Hi everybody, > > I set apache authentication against django's user database. and I want > to limit a location to a

Re: Django Suitability

2008-10-23 Thread Adam Nelson
Matt, I feel your pain. It's probably not best on the Django forum to say this but: 1. Any modern framework is fine (Cake/PHP, Django/Python, Merb/Ruby, etc...) 2. Use a framework of some sort (don't just roll with 'Java' without some sort of web-specific framework for your needs) 3. Any real

Re: Mercurial or Git

2008-10-23 Thread Justin Lilly
Alternatively, you can find several git/bzr/hg mirrors for django here: http://code.djangoproject.com/wiki/DjangoBranches So feel free to pull from those with your DVCS. As so few of us are commiters anyway (and those who are, likely know how to hand the exception), it should be the same as if

Re: Mercurial or Git

2008-10-23 Thread [EMAIL PROTECTED]
I would recommend Bazaar. In my opinion it has a simpler and more intuitive command set than Git or Mercurial. It can also import code history from Subversion, and has good integration with Trac. Bazaar is fundamentally a distributed VCS, but has specific support for a central repository

Re: variable tag / filter

2008-10-23 Thread Jeff FW
To my knowledge, no, it's not possible to do that. Even if it was, however, I would strongly argue against it, as it would make your templates unreadable--how would you know what filter/tag would be called without mucking through the rest of your code? Maybe there's a better way to get the

Re: Accidentally creating a model with "def unicode(self):" will crash django with no stack trace

2008-10-23 Thread Jeff FW
That's because when you define unicode(), inside the scope of that function, the name "unicode" is now bound to the function you just defined. So, the line "date = unicode(self.dated)" is calling Letter.unicode() instead of Python's builtin unicode(), and you get an (almost) infinite recursive

Re: About running django 1.0 and MySQL

2008-10-23 Thread Ma Kwong Chia
Thank you! On Thu, Oct 23, 2008 at 2:21 PM, web_geek <[EMAIL PROTECTED]> wrote: > hi, > > I'm running Django-1.0-1.el5 and mysql-5.0.45-7.el5 on a Red Hat > Enterprise Linux 5.2 box. Some how I still confuse what must be done > to set up Django to talk to MySQL. May I ask for your advice about >

Re: dynamic upcast

2008-10-23 Thread dadapapa
On Oct 19, 10:10 pm, Carl Meyer <[EMAIL PROTECTED]> wrote: > Just ran into this issue myself (first time using non-abstract > inheritance).  The catch with this recipe is that you can never save a > derived object from a parent instance, or you break the final_type > field (it will then contain

Exception thrown from django.test.client.Client

2008-10-23 Thread [EMAIL PROTECTED]
I found this problem while trying out the django test client: $ ./manage.py shell >>> from django.test.client import Client >>> c = Client() >>> c.get('/') Traceback (most recent call last): File "", line 1, in File "/var/lib/python-support/python2.5/django/test/client.py", line 265, in get

Re: How to add custom validation to inline admin forms, overriding clean(self) or clean_FIELD(self) doesn't work.

2008-10-23 Thread Karen Tracey
On Thu, Oct 23, 2008 at 5:09 AM, Jacob Rigby <[EMAIL PROTECTED]> wrote: > > I have a custom ModelForm with a TabularInline child form. I can edit > and save without problems, and simple field validation is working (if > a required field is missing from the inline form it shows a warning). > But

Re: Following tutorial but can't get something

2008-10-23 Thread gryzzly
Hey Heather, Sure, and everything else does work. Every other view that points to template that is in the same folder where “results” is does work. On Oct 23, 2:04 pm, Heather <[EMAIL PROTECTED]> wrote: > If the file is there, did you tell your settings file where to look > for templates? > > On

Development of presentation editing module

2008-10-23 Thread Daniele Procida
I have sketched out an idea for an interface to apply presentation to blocks in semantic HTML content. We need a Django module that will implement this idea, and would like to find a developer or team of developers who can help refine the idea and produce a module. The work will be done

Re: Following tutorial but can't get something

2008-10-23 Thread Heather
If the file is there, did you tell your settings file where to look for templates? On Oct 23, 4:00 am, gryzzly <[EMAIL PROTECTED]> wrote: > It is self-expalnatory, but the problem is that I do have a template > file. And it is there. > > On Oct 23, 12:36 am, "Karen Tracey" <[EMAIL PROTECTED]>

Re: problem with Form, but ModelForm works fine?

2008-10-23 Thread [EMAIL PROTECTED]
Sorry, I realized my own mistake a few hours later. The problem was that I copied and pasted the fields from my Model. The entities in my Form class were: django.models instead of django.forms Changing this solved the problem. On Oct 23, 1:37 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:

Re: Mercurial or Git

2008-10-23 Thread Russell Keith-Magee
On Thu, Oct 23, 2008 at 3:54 AM, Rit Lim <[EMAIL PROTECTED]> wrote: > > which one is the Django community moving toward to, mercurial or git? > if Django is to be moved... Several of the core developers are already using distributed version control systems to manage their activities. Git, for

problem with Form, but ModelForm works fine?

2008-10-23 Thread [EMAIL PROTECTED]
I'n new to django, and I am having trouble with forms: I tried following the example on the web page: http://docs.djangoproject.com/en/dev/topics/forms/#topics-forms-index I setup a quick unit test, but I am unable to get the desired result with forms.Form. I replaced my forms.Form object with a

Django Model design: OOP or Database-centric approach?

2008-10-23 Thread dustpuppy
Hi, I'm starting off with Django and trying my first (toy) project. It's a Kris Kindle application (called "Secret Santa"? by some). Not exactly earth-shattering, but I want to start with something small. I'm unsure what approach to use when designing my model. The entities I am dealing with

Get raw data in adminform

2008-10-23 Thread Mussorgsky
In pre 1.0 I could get raw data in the admin change_form with {{ form.data.fieldnameabc }} this does not work with 1.0 using newforms. How would I do this now (post 1.0)? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

from mysite.polls.models import Poll, Choice

2008-10-23 Thread tak
Hi, I am following the tutorial. One part I get confusion is the import statement including the project name. I am referring the last example of 1st tutorial. A project name is a collection of application, so should any statement in the project not refer to it? Does anyone have a answer to

Problem when visit admin site for add a new item with manytomanyfield

2008-10-23 Thread IL
from django.db import models class Song(models.Model): name = models.CharField(max_length = 50, unique = True) lyricBy = models.CharField(max_length = 10, null = True, blank = True) coSinger = models.CharField(max_length = 10, null = True, blank = True) def __str__(self):

Re: login_required for imported apps

2008-10-23 Thread Heather
> Authentication is actually handled by a middleware, you know ?-) Heh, well, this is true so I guess it's not such a big deal, then. > Ok, I already expressed MVHO on this, which is that having a clean way > to apply a same decorator to a whole set of urls at once would be a > good thing. Now

Re: setting a 'default' filter for templates

2008-10-23 Thread Ned Batchelder
You could modify your view function (typed off the top of my head, so the details may be wrong): # ...blah blah build your context... for name, value in context.items(): context[name] = special_function(value) return render_to_response('template.html', context) If you have a

Re: Django Suitability

2008-10-23 Thread Matthew Talbert
Thanks, Dj, that is helpful. > A project I worked on over the summer used a Database that was 130 > tables, and getting 1gb updates every 2 minutes. I was witting a new > web app to do calculations on the data and the company wanted to use > Java since thats what they knew best and had spend

variable tag / filter

2008-10-23 Thread ramya
Is it possible to have variable tags / filters {{ my_value | my_filter }} where c['my_filter'] = 'formatDateTime' formatDateTime is the actual filter function defined in templatetags similarly {{ my_tag my_filter }} where c['my_tag'] = 'formatDateTime' formatDateTime is the actual tag

  1   2   >