queryset by custom field

2007-05-21 Thread John M
Is it possible to order a queryset by a custom field? I have several programmatic generated fields and need to sort the display by them, is this possible? Thanks John --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: select_related() and child rows

2007-05-21 Thread simonbun
As far as i know, select_related doesn't work across reverse relationships. Sometimes it's possible to just query the base model to achieve the same results, but not always. Maybe its a good feature for the query.py rewrite, but i'm thinking it could get ugly pretty fast. It would require a new

Re: newforms unique field(s)

2007-05-21 Thread simonbun
Great stuff again Malcolm. Perhaps it should be rehashed a bit and put in the newforms docs under 'custom validation' ? Just a thought :) regards, Simon On May 22, 12:11 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Mon, 2007-05-21 at 14:00 -0500, Tim Chase wrote: > > > What is the

Re: why a key error

2007-05-21 Thread John M
BTW, That did it! I copied the code from the save_instance() update and fixed my problem. Thanks again. John On May 21, 7:29 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Tue, 2007-05-22 at 02:14 +, John M wrote: > > Malcolm, > > > Here is the traceback from line 41: > >

Re: why a key error

2007-05-21 Thread John M
Malcolm, Thank you so much for discovering my problem, I was hoping it was the newforms code and not mine ;-P. Yea, that form= trick seems to work, not sure why, but it does. I've also seen the callback one too, but that seemed rather complicated, and I'm not much for complicated code :- I'll

Django-tagging app not showing up in admin

2007-05-21 Thread [EMAIL PROTECTED]
I'm building a blog using Django, and am wanting to use django-tagging for, well, tagging. But something isn't working right. And I haven't a clue why (yes, I'm a beginner). I've added the tagging app to my INSTALLED_APPS in the settings.py file. It is located inside my project, which is also

Re: why a key error

2007-05-21 Thread Malcolm Tredinnick
On Tue, 2007-05-22 at 02:14 +, John M wrote: > Malcolm, > > Here is the traceback from line 41: > c:\python24\lib\site-packages\django\newforms\models.py in > save_instance > > 34. opts = instance.__class__._meta > 35. if form.errors: > 36. raise ValueError("The %s could not be

Re: WANTED: Demonstration of good FK & M2M form creation

2007-05-21 Thread John M
Next time I'll RTFT (read the fliping thread) correctly :-P Thanks Malcolm. J On May 21, 6:30 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Mon, 2007-05-21 at 18:25 -0700, John M wrote: > > So Malcolm, does that mean its in the devl version we could see? > > > J > > > On May 21, 5:56

Re: why a key error

2007-05-21 Thread John M
Malcolm, Here is the traceback from line 41: c:\python24\lib\site-packages\django\newforms\models.py in save_instance 34. opts = instance.__class__._meta 35. if form.errors: 36. raise ValueError("The %s could not be changed because the data didn't validate." % opts.object_name) 37.

Re: rendering files in markdown

2007-05-21 Thread Milan Andric
Last one, promise. On May 21, 5:53 pm, Milan Andric <[EMAIL PROTECTED]> wrote: > > On May 17, 5:34 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > > > [snip] > > >http://code.google.com/p/django-template-utils/wiki/GenericMarkup > > Ok, I've got to be pretty close here. I went ahead and

Re: why a key error

2007-05-21 Thread Malcolm Tredinnick
Hi John, On Mon, 2007-05-21 at 18:41 -0700, John M wrote: > i am getting a key error with the following: > > sqlite3 > > class Holding(models.Model): > portfolio = models.ForeignKey(Portfolio, editable=False) > symbol = models.CharField(maxlength=10) > reason =

Displaying my table data

2007-05-21 Thread Greg
I am trying to display the table in my Choice table. However it's error's out everytime I try to see the contents of the table. In my python shell prompt I do the following and get the error C:\django\mysite>python manage.py shell (InteractiveConsole) >>> from mysite.rugs.models import Choice

why a key error

2007-05-21 Thread John M
i am getting a key error with the following: sqlite3 class Holding(models.Model): portfolio = models.ForeignKey(Portfolio, editable=False) symbol = models.CharField(maxlength=10) reason = models.CharField(maxlength=200, blank=True, null=True) shares =

Re: Decimal fields have landed on trunk: rename your FloatFields

2007-05-21 Thread Uros Trebec
Hi guys! I can't believe how fast are you developing Django! I had a 2 days old checkout and was looking at current model documentation... and the validation kept saying "'module' object has no attribute 'DecimalField'". I was ready to give up and take a nap to clear my mind when I thought I

Re: WANTED: Demonstration of good FK & M2M form creation

2007-05-21 Thread Malcolm Tredinnick
On Mon, 2007-05-21 at 18:25 -0700, John M wrote: > So Malcolm, does that mean its in the devl version we could see? > > J > > On May 21, 5:56 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> > wrote: [] > > It sounds like you want the django.newforms.formsets capability that > > isn't on trunk

Re: WANTED: Demonstration of good FK & M2M form creation

2007-05-21 Thread John M
So Malcolm, does that mean its in the devl version we could see? J On May 21, 5:56 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Sun, 2007-05-20 at 11:19 -0700, David Priest wrote: > > I believe I have performed exhaustive research on the challenge of > > creating forms that

Re: WANTED: Demonstration of good FK & M2M form creation

2007-05-21 Thread Malcolm Tredinnick
On Sun, 2007-05-20 at 11:19 -0700, David Priest wrote: > I believe I have performed exhaustive research on the challenge of > creating forms that incorporate fields from multiple tables. I have > not found *any* comprehensive, best-practices examples of this problem. > > It really quite

Re: rendering files in markdown

2007-05-21 Thread Milan Andric
> On May 17, 5:34 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > > [snip] > >http://code.google.com/p/django-template-utils/wiki/GenericMarkup Ok, I've got to be pretty close here. I went ahead and created an empty app with just a template tags directory mmtags/templatetags/ mm_markup.py ...

WANTED: Demonstration of good FK & M2M form creation

2007-05-21 Thread David Priest
I believe I have performed exhaustive research on the challenge of creating forms that incorporate fields from multiple tables. I have not found *any* comprehensive, best-practices examples of this problem. It really quite surprises me, as any web application of even moderate complexity

Re: Solution to multiple models on one form?

2007-05-21 Thread David Priest
On 07-May-18, at 6:33 AM, Malcolm Tredinnick wrote: > > On Thu, 2007-05-17 at 20:08 -0700, David Priest wrote: >> It occurs to me that were I able to write the following: >> models_list = ( >> 'project.app1.models.Claim', >> 'project.app2.models.Vendor') > > Why

Re: Solution to multiple models on one form?

2007-05-21 Thread David Priest
After bashing at it some more, I had to conclude I was out to lunch. It is killing me to wait for newforms. It's senseless for me to learn old forms, but I'm having a helluva time making heads or tails of newforms. Some things that I swear must be common as mud -- like a form that sends

Re: Voting systems & postgres transaction

2007-05-21 Thread Russell Keith-Magee
On 5/21/07, ZebZiggle <[EMAIL PROTECTED]> wrote: > > UPDATE Content SET voteTotal = voteTotal + 1 WHERE id = ... > > Anyone have any thoughts on the problem? What am I missing? I've thought about this before; IMHO, the right solution is to provide an easy syntax for a Django query (or in this

Re: Feature request: Generic add/change features (similar to admin)

2007-05-21 Thread Russell Keith-Magee
On 5/21/07, jj <[EMAIL PROTECTED]> wrote: > Wouldn't it be cool if generic views supported add/change out of the > box, and the only code to write was a 1-liner equivalent to admin's > "fields=(...,)"? Could the current admin rewrite be the occasion to > factor out this functionality and make it

Re: initial data + cut up models.py = trouble?

2007-05-21 Thread Russell Keith-Magee
On 5/21/07, Bram - Smartelectronix <[EMAIL PROTECTED]> wrote: > > hey everyone, > > I successfully cut up my models.py into different files, so now I have: ... > to make things simpler. In all my models I have: > > class Meta: > app_label = 'myapp' > > Now I have one problem: my

Re: newforms unique field(s)

2007-05-21 Thread Malcolm Tredinnick
On Mon, 2007-05-21 at 14:00 -0500, Tim Chase wrote: > > What is the "general way" to add your own validation to forms under > > the newforms framework? > > > > Subclassing and adding in your clean_* methods? Using decorators or > > the such around existing validation? Adding your own custom

Re: newforms unique field(s)

2007-05-21 Thread Malcolm Tredinnick
[Apologies if this appears twice. I think Google ate my homework the first time.] On Mon, 2007-05-21 at 14:00 -0500, Tim Chase wrote: > > What is the "general way" to add your own validation to forms under > > the newforms framework? > > > > Subclassing and adding in your clean_* methods? Using

Re: newforms unique field(s)

2007-05-21 Thread Malcolm Tredinnick
On Tue, 2007-05-22 at 08:11 +1000, Malcolm Tredinnick wrote: > On Mon, 2007-05-21 at 14:00 -0500, Tim Chase wrote: > > > What is the "general way" to add your own validation to forms under > > > the newforms framework? > > > > > > Subclassing and adding in your clean_* methods? Using decorators

Re: Explain the template for serving static files?

2007-05-21 Thread Malcolm Tredinnick
On Mon, 2007-05-21 at 19:17 +, Val wrote: > > DEFAULT_DIRECTORY_INDEX_TEMPLATE = """ > www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > http://www.w3.org/1999/xhtml; xml:lang="en" lang="en"> > > > > > Index of {{ directory|escape }} > > > Index of {{

Re: Encoding trouble: db interaction

2007-05-21 Thread Malcolm Tredinnick
On Mon, 2007-05-21 at 06:07 -0700, sandro dentella wrote: > well, ok. It's the utf-8 encoded version of u'F\xf2' I imagine. But > why if I change DEFAULT_CHARSET > to ' latin-1' it does not get encoded in 'latin-1'? is the db > encoding winning over DEFAUL_ENCODING? I don't know how many times

Re: rendering files in markdown

2007-05-21 Thread Milan Andric
On May 18, 1:59 am, Milan Andric <[EMAIL PROTECTED]> wrote: > On May 17, 5:34 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > > [snip] > >http://code.google.com/p/django-template-utils/wiki/GenericMarkup > > Thanks alot for writing this, it was a sinch to get going. > > Now I have a def

Re: saving queries

2007-05-21 Thread FrankW
Oops - I didn't read far enough in the DB API! Q objects do exactly this! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com

Re: Decimal fields have landed on trunk: rename your FloatFields

2007-05-21 Thread Malcolm Tredinnick
On Mon, 2007-05-21 at 13:22 +, waylan wrote: > Mmm, good things come to those who wait. It's nice to see this finally > come through. Thanks for all the hard work. > > Btw, it looks like there is a small bug in the docs [1]. Just add a > couple tildes to the DecimalField section header (line

Re: newforms unique field(s)

2007-05-21 Thread Matt
After looking at http://code.google.com/p/django-registration/: forms.py [...] def clean_username(self): """ Validates that the username is not already in use. """ if self.cleaned_data.get('username', None): try: user =

Django Developers Needed

2007-05-21 Thread [EMAIL PROTECTED]
All, BravoLog is looking to hire contract a team of django developers and a couple of team leaders to work on our application, a record-keeping and social networking service for pilots and aircraft owners. We have a great opening that just came up for a lead development position, responsible

Re: URLPattern - can't fetch a detail page

2007-05-21 Thread Panos Laganakos
Right on the money Martin! Thanks alot. I knew it was something *stupid* I had done, but after looking at the project for so long, you lose your clarity for details :/ On May 21, 8:30 pm, "Martin Glueck" <[EMAIL PROTECTED]> wrote: > Looking at the urls pattern reported in the 404 page it looks

Explain the template for serving static files?

2007-05-21 Thread Val
DEFAULT_DIRECTORY_INDEX_TEMPLATE = """ http://www.w3.org/1999/xhtml; xml:lang="en" lang="en"> Index of {{ directory|escape }} Index of {{ directory|escape }} {% for f in file_list %} {{ f|escape }} {% endfor %} """ What exactly

Is Mark Warren's Ultimate Wealth Package Worth the Money?

2007-05-21 Thread Moona Naeem
Is Mark Warren's Ultimate Wealth Package Worth the Money? You could go take a college course in marketing or entrepreneurship at your local university or community college and spend thousands of dollars. I took a course called Principles of Marketing. http://2site.com/cnrqev "Legitimate"

Re: newforms unique field(s)

2007-05-21 Thread Tim Chase
> What is the "general way" to add your own validation to forms under > the newforms framework? > > Subclassing and adding in your clean_* methods? Using decorators or > the such around existing validation? Adding your own custom Field > objects and setting their "clean" methods? My

select_related() and child rows

2007-05-21 Thread Beau Hartshorne
I've got some models that look something like this: class Entry(models.Model): text = models.TextField() class SubEntry(models.Model): text = models.TextField() sub_entry = models.ForeignKey(Entry) class SubSubEntry(models.Model): text = models.TextField() sub_sub_entry =

Apache configuration

2007-05-21 Thread dystopia
I've got this in my Apache httpd.conf: SetHandler python-program PythonHandler django.core.handlers.modpython PythonPath "['/var/www/dev.django.exampleurl.co.uk/'] + sys.path" SetEnv DJANGO_SETTINGS_MODULE mysite.settings PythonDebug On I also have this set up in my

Re: Adding attibutes to models via mixins

2007-05-21 Thread Marek Kubica
Hi, On Mon, 21 May 2007 06:11:52 +1000, Malcolm Tredinnick wrote: > You're probably going to have to look at the ModelBase.__new__ method > and work in nicely with that as well. Django's model creation metaclass > stuff is fairly key to how things work. > > You might want to read the

Re: URLPattern - can't fetch a detail page

2007-05-21 Thread Martin Glueck
Looking at the urls pattern reported in the 404 page it looks like there is twice the "^" symbol. And I would say that is the problem because this symbol tries to match the "start of a line", so the pattern "^news/ ^/(?P[a-zA-Z0-9-_]+)/?$" will never match to "/news/hello/". my guess is that you

Re: Voting systems & postgres transactions

2007-05-21 Thread ZebZiggle
Hmm, I suppose another approach and possible horrible hack might be: 1. Create a queue of updates to the Content object 2. Votes are appended to the queue and immediately added to the UserContentRelationship table. 3. A separate thread processes the queue periodically to ensure atomic updates to

Re: URLPattern - can't fetch a detail page

2007-05-21 Thread Panos Laganakos
Hehe, this is getting old, but still things don't work. There's no special stack trace here, I only get returned a 404 page result for the list_detail page. here's the full urls.py: from django.conf.urls.defaults import * from myproj.news.models import Entry news_list_info = {

newforms unique field(s)

2007-05-21 Thread Matt
I have a form that allows users to submit their name and email address for an invitation. I do not want people signing up more than once. The following code works, but it does not seem like the "Best Practice" solution. forms.py [...imports...] class RequestInvite(forms.Form): name =

Re: I'm not sure how to write this database command in django... any thoughts?

2007-05-21 Thread Roboto
Okay.. solved my issue... but ran into another one. Rows are returned - however output is returned with no Keys looks like this [(4, 2, 'ACT', 3, 'Chris', 'Yiu'), (2, 2, 'ADM', 1, 'Robert', 'Chan')] Anyone have any thoughts on how to get the keys? On May 21, 11:35 am, Roboto <[EMAIL

Voting systems & postgres transactions

2007-05-21 Thread ZebZiggle
Yes, this is yet another voting design discussion. As far as I can see there are two approaches: 1. A separate table that records the User-Content relationship including the vote -1/0/+1 and, optionally: 2. A voting field in with the content that gets atomically updated with each vote. Just

Re: I'm not sure how to write this database command in django... any thoughts?

2007-05-21 Thread Roboto
Thanks, Yes this was true indeed! In any event, I've had to resort to using a custom SQL statement to solve my issue. Although, I know the query works (tested in psql), and nothing is crashing, but I'm not getting any output from the system... it's quite odd actually... I don't know why just

Re: How to Display 2 items of an Object

2007-05-21 Thread robo
Great ideas! Thanks Kelvin. I'll definitely try it out and post the results here, robo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Decimal fields have landed on trunk: rename your FloatFields

2007-05-21 Thread waylan
Mmm, good things come to those who wait. It's nice to see this finally come through. Thanks for all the hard work. Btw, it looks like there is a small bug in the docs [1]. Just add a couple tildes to the DecimalField section header (line 188??). [1]:

Feature request: Generic add/change features (similar to admin)

2007-05-21 Thread jj
One of the best features of Django admin is the ability to add and edit objects without writing any code OR template. However, no such built-in functionality on the non-admin part of the site. Everyone has to reimplement it on its own, which is cumbersome and difficult to get right or as good.

Re: Encoding trouble: db interaction

2007-05-21 Thread sandro dentella
well, ok. It's the utf-8 encoded version of u'F\xf2' I imagine. But why if I change DEFAULT_CHARSET to ' latin-1' it does not get encoded in 'latin-1'? is the db encoding winning over DEFAUL_ENCODING? sandro *:-) oh, i'd like to be an ascii speaking... ;-)

initial data + cut up models.py = trouble?

2007-05-21 Thread Bram - Smartelectronix
hey everyone, I successfully cut up my models.py into different files, so now I have: models/ + something1.py + something2.py + something3.py and in __init__.py from something1 import * from something2 import * from something3 import * to make

Encoding trouble: db interaction

2007-05-21 Thread Sandro Dentella
After some weeks of relative good relationship with unicode I met a new problem. Digging into it I see things I cannot understand and I'm not sure how these are related to my problem. I'm using postgresql, psycopg2, DEFAULT_CHARSET='utf-8', db encoding unicode. In [1]: from

Get paid to surf Ads....its real...

2007-05-21 Thread coolguy17111987
Hi all Now you can get paid to surf ads..All you need to do is register on their site, surf ads for 30 seconds. And you will be credited with the earning immediately. Ist'nt dat amazing. Many of you must have already joined, for rest dont wait...hurry up... Sooner you join more you earn

Re: Scheduler proposal

2007-05-21 Thread Christian Markwart Hoeppner
You might want to look into generating some sort of cron file from within the framework. Writing a plaintext file is not that hard. Maybe just write it somewhere within your project folder and make cron "include" it, though I'm unsure wether cron is able to do such an include/import with the

Re: How to change "create table" sql statements in sqlall/syncdb

2007-05-21 Thread Sebastjan Trepca
I found out the "sqlcustom" feature in manage.py and also new PostgreSQL server supports setting inheritance through ALTER TABLE command, so this solves my problem :) Sebastjan On 5/21/07, Sebastjan Trepca <[EMAIL PROTECTED]> wrote: > > Hi, > > I use PostgreSQL for database backend and its

Re: Business Application

2007-05-21 Thread Nebojša Đorđević
On 20.05.2007., at 17:04, Christian M Hoeppner wrote: > mod_python holds code in memory, just like mod_perl. This makes > things go a > whole lot faster. FCGI is the "traditional" way of doing things. > For every > request a new call (and perhaps a new spawn) is made to the fcgi > binary.

Re: Aggregate function in django

2007-05-21 Thread Brij
I m still not able to get a proper django SQL query for the same...I used the above query but it says somedb.Objective table doesnt exist i m a newbie to django...and m not able to get hold of this "extra" api provided by the django -Brij --~--~-~--~~~---~--~~

Introduction to CRM

2007-05-21 Thread Ankur
Hi All, I just found a link which seems to be quite informative about CRM. Just try the link below to have a look at it. http://www.quazen.com/Business/Management/Introduction-to-CRM.25530 This contains the basics of CRM. I really loved this article. Thanks, Ankur

Re: Django Book

2007-05-21 Thread Marc Fargas Esteve
On 3/14/07, Derek Lee-Wo <[EMAIL PROTECTED]> wrote: > > Amazon shows that the book on Django will be published on March 26th > which is 1 1/2 weeks away. Does anyone know if that date is still > valid? > > I'm anxiously waiting to order it. Uhm.. I think they will wait until Django 1.0 hits the

Re: Generic relations naming

2007-05-21 Thread James Bennett
On 5/21/07, Sebastjan Trepca <[EMAIL PROTECTED]> wrote: > I just started to use generic relations and I was wondering why are the > default field names "object_id" and "content_type" and not "object_id" and > "object_type"? > Seems better that way and more logical ... or is it? I would guess

Re: Can I prepopulate a SlugField with a ForeignKey?

2007-05-21 Thread john
add another function: def get_fields(self): return self.color, self.size, self.price --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Generic relations naming

2007-05-21 Thread Sebastjan Trepca
Hi, I just started to use generic relations and I was wondering why are the default field names "object_id" and "content_type" and not "object_id" and "object_type"? Seems better that way and more logical ... or is it? Thanks, Sebastjan --~--~-~--~~~---~--~~ You