Re: admin.site.register errors (due to user mistake)

2008-10-21 Thread Malcolm Tredinnick
On Tue, 2008-10-21 at 19:51 -0700, [EMAIL PROTECTED] wrote: > If you make a boneheaded move such as creating a ModelAdmin class for > a model that you forgot to include in your admin.py's model import > statement, you get an error. But it's not the error you might expect. > What happens is you ge

Re: Can't do any manipulation on a db object

2008-10-21 Thread Malcolm Tredinnick
On Tue, 2008-10-21 at 22:30 -0700, guruyaya wrote: [...] > blog/views.py > --- > from django.shortcuts import render_to_response as RenderToResponse > from myblog.blog.models import Post > def listposts(request): > a = Post.objects.all() > a[0].title = 'hihi' > a[0

Re: Can't do any manipulation on a db object

2008-10-21 Thread Malcolm Tredinnick
On Tue, 2008-10-21 at 23:33 -0700, guruyaya wrote: > This is actually worse You mean top-posting? Yes, it's a terrible habit and you should stop doing it. > > blog/models.py > > from django.shortcuts import render_to_response as RenderToResponse > from myblog.blog.models impor

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 > Restaurant

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 mess

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 u

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 = mode

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) for

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 rec

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: 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: 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 gues

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: 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 that)

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

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 moderate_comm

Re: where is the error ?? dictionary update sequence element #0 has length 1; 2 is required

2008-10-24 Thread Malcolm Tredinnick
On Thu, 2008-10-23 at 23:59 -0700, Net_Boy wrote: [...] > --- > views.py: > def bid_history(request, object_id):item = get_object_or_404(Item, > item_id=object_id) > bid_history = Bid.objects.filter(bid_item=item).order_by('- > bid_price') > return render_to_response("bid_list

Re: template system file extensions

2008-10-28 Thread Malcolm Tredinnick
On Tue, 2008-10-28 at 15:52 -0700, IMTheNachoMan wrote: > I have a thought for improvement. Currently the template files use > a .html extension for template files. That's not correct. Template files can have any extension you like. Django deliberately does not use the file extension to mean any

Re: Join of any db table with Q.add_to_query

2008-11-10 Thread Malcolm Tredinnick
On Mon, 2008-11-03 at 03:02 -0800, Dima Dogadaylo wrote: > Before merging of queryset-refactor it was possible to join any table > with any ON clause to any queryset with help of Q.as_sql. It was "possible" for small values of possible that meant "extremely fragile and didn't work in a large nu

Re: SQL in queryset extra method not showing in results

2008-11-10 Thread Malcolm Tredinnick
On Sun, 2008-11-09 at 22:19 -0800, chris wrote: > Dear Django users, > > Here is the problem I am trying to solve: > > I have a Reference object defined as follows: > > class Reference(models.Model): > person = models.ForeignKey(Person) > author = models.CharField(max_length = 20, bla

Re: How can I create a new table without primary key filed?

2008-11-10 Thread Malcolm Tredinnick
On Mon, 2008-11-10 at 03:41 -0800, K*K wrote: > Thank you for you reply. > > But I mean I want to create a table without primary key field. This isn't going to work very well with Django. There are a lot of places in Django that use the primary key on a table to access it. So tables without pr

Re: SQL in queryset extra method not showing in results

2008-11-11 Thread Malcolm Tredinnick
On Mon, 2008-11-10 at 14:52 -0800, chris wrote: > Now, to answer myself, I found the solution: > > qs = > Reference.objects.all().extra(select={'title_count' > :'COUNT(*)'}).values('title', > 'title_count') > qs.query.group_by = ['title'] > > This gives me exactly the aggregated list of titles

Re: using Etags or http response code 304 (not modified)

2008-11-11 Thread Malcolm Tredinnick
On Tue, 2008-11-11 at 05:08 -0800, [EMAIL PROTECTED] wrote: > hi Karen, > > thanks for the response..I havent verified if the client is sending > the If-none-match header. Essentially my project uses rss feeds. and i > redirect them to feedburner. I dont want my site to keep sending http > 200 a

Re: Valid URL rejected by URLField

2008-11-11 Thread Malcolm Tredinnick
On Tue, 2008-11-11 at 16:57 -0800, Julien Phalip wrote: > Hi, > > The following URL is rejected when validating a URLField form field: > http://portal.oas.org/Portal/Topic/SEDI/Educaci%C3%B3nyCultura/Cultura/ReunionesdelosMinistrosdeCultura/Cuartareuni%C3%B3nministerial/tabid/1416/language/en-US

Re: SECRET_KEY

2008-11-11 Thread Malcolm Tredinnick
On Wed, 2008-11-12 at 00:12 -0200, Juanjo Conti wrote: > Is there any problem with changing my SECRET_KEY from a running project? Searching for all uses for the word SECRET_KEY in the source of Django would have gone a fair way towards answering that question. There aren't too many things to wo

Re: TemplateDoesNotExist

2008-11-11 Thread Malcolm Tredinnick
On Tue, 2008-11-11 at 20:05 -0800, [EMAIL PROTECTED] wrote: > Hello, > > I'm getting this error and the missing template IS in the template > directory defined in settings.py and views.py Everything looks correct visually, with one exception: > > # SETTINGS.PY > TEMPLATE_DIRS = ( > # Put

Re: SECRET_KEY

2008-11-12 Thread Malcolm Tredinnick
On Wed, 2008-11-12 at 13:29 -0500, Marty Alchin wrote: > On Tue, Nov 11, 2008 at 10:05 PM, Malcolm Tredinnick > <[EMAIL PROTECTED]> wrote: > > On Wed, 2008-11-12 at 00:12 -0200, Juanjo Conti wrote: > >> Is there any problem with changing my SECRET_KEY from a running

Re: Problem with named URL and parameters

2008-11-12 Thread Malcolm Tredinnick
On Wed, 2008-11-12 at 22:39 -0500, Karen Tracey wrote: > On Wed, Nov 12, 2008 at 10:27 PM, Brandon Taylor > <[EMAIL PROTECTED]> wrote: > > Hi everyone, > > So I have a question/problem with a named URL pattern... > > #urls.py > url(r'^res

Re: Counting comments for a list of posts

2008-11-12 Thread Malcolm Tredinnick
On Wed, 2008-11-12 at 20:31 -0800, Jason K wrote: > I would have thought this would be a simple thing, but I'm at a loss > as to how to go about it.. > > I'm displaying a list of posts by a particular user, and trying to > find a way of getting the comment count for each post to display, > witho

Re: TemplateDoesNotExist

2008-11-12 Thread Malcolm Tredinnick
On Wed, 2008-11-12 at 22:12 -0800, [EMAIL PROTECTED] wrote: > The directory structure is: > > /home/USERNAME/projects/django_templates/SITENAME/polls > - index.html > - base.html If the directory name is "/home/USERNAME/project/..", then why have you put "/django_projects/django_templates/polls

Re: TemplateDoesNotExist

2008-11-12 Thread Malcolm Tredinnick
On Wed, 2008-11-12 at 23:05 -0800, [EMAIL PROTECTED] wrote: > Sorry about the inconsistency but just to be clear, here is what I > have: > > Dreamhost directory structure: > > TEMPLATE_DIRS = ( > # Put strings here, like "/home/html/django_templates" or "C:/www/ > django/templates". > #

Re: TemplateDoesNotExist

2008-11-13 Thread Malcolm Tredinnick
On Thu, 2008-11-13 at 11:12 -0800, sergioh wrote: > > are you using fastcgi? it could be an error on your syspath? The filesystem path in TEMPLATE_DIRS has absolutely nothing to do with Python's import path. These are files that are loaded via os.open() and read(). They aren't Python files at

Re: Views triggering twice

2008-11-13 Thread Malcolm Tredinnick
On Thu, 2008-11-13 at 17:03 -0500, Jeff Gentry wrote: > > Another piece of info, in case it's useful here - the page does *not* > render on the first view call, it's only after the second call that the > page will render. I don't think it's even pulling up the template until > the second go-aro

Re: Problem with named URL and parameters

2008-11-13 Thread Malcolm Tredinnick
On Fri, 2008-11-14 at 01:20 +0300, Alex Koshelev wrote: > Hmm... Why in template tag you wrote `conversions` as view name but in > error traceback there is `my_site.conversions`? Because the error reporting from URL resolution is retarded. :-( The last thing it tries is . and that's what it rep

Re: Problem with named URL and parameters

2008-11-13 Thread Malcolm Tredinnick
On Thu, 2008-11-13 at 17:06 -0800, Brandon Taylor wrote: > Hi everyone, > > Gerard's suggestion worked. Moving the pattern into a separate > definition fixed it. But, I couldn't explain why :) Then there's some kind of bug there. :-( Malcolm --~--~-~--~~~---~--~-

Re: Exclude fields in form by language

2008-11-13 Thread Malcolm Tredinnick
On Thu, 2008-11-13 at 18:06 -0800, Brandon Taylor wrote: > Hi everyone, > > I'm doing an internationalization project and have a form with fields > that need to be localized. I would like to have one form, pass in the > language code and exclude the appropriate fields. > > How would I go about

Re: Exclude fields in form by language

2008-11-13 Thread Malcolm Tredinnick
On Thu, 2008-11-13 at 20:36 -0800, Brandon Taylor wrote: > Hi Malcom, > > This is what I have so far, but is not working... > > #forms.py > class CreditApplicationForm(forms.Form): > def __init__(language_code, *args, **kwargs): > super(CreditApplicationForm, self).__init__(*args, *

Re: creating django middleware

2008-11-14 Thread Malcolm Tredinnick
On Fri, 2008-11-14 at 00:39 -0800, ershadul wrote: > Dear Steve Holden, > Please consider the following block i wrote: > > def process_request(self, request): > request.db_session = session() > request.db_session.time_stamp = str(datetime.datetime.now()) > print 'process_

Re: Cron job help..

2008-11-14 Thread Malcolm Tredinnick
On Fri, 2008-11-14 at 02:52 -0800, laspal wrote: > Hi, > I am trying to write cron job for trigger mail whenever task is > overdue. [... snip ...] > So my problem is how do I run it.I mean how can I connect to my djanog > project?? > here is my project path -> /home/work/test/ > my settings.py

Re: Custom feed generator

2008-11-14 Thread Malcolm Tredinnick
On Fri, 2008-11-14 at 02:55 -0800, timc3 wrote: > Has anyone got an example of a custom feed generator? > > I am trying to create one and but I don't seem to be overriding the > correct methods: Or explaining what is going wrong. :-) Care to give us a few clues as to the problems you're seeing

Re: Is There Anyway to Make the Cache Template Tag Cache Stuff Based on the User Session?

2008-11-14 Thread Malcolm Tredinnick
On Fri, 2008-11-14 at 03:24 -0800, Sebastian wrote: > The following code would show the same content for all users: > > {% cache 500 usertags %} > > {% for tag in tags%} > {{ tag }} > {% endfor %} > > {% endcache %} > > > I need to to be able to cache template content based on the user > s

Re: Custom feed generator

2008-11-14 Thread Malcolm Tredinnick
On Fri, 2008-11-14 at 04:22 -0800, timc3 wrote: > > Or explaining what is going wrong. :-) > > > > Care to give us a few clues as to the problems you're seeing? On the > > surface, your class looks fairly much correct. > > ha ha!! Yes of course this is the message that I am getting: > > File "/

Re: Custom feed generator

2008-11-14 Thread Malcolm Tredinnick
On Fri, 2008-11-14 at 23:38 +1100, Malcolm Tredinnick wrote: [...] > Something with a get_object() method should be a subclass of > django.contrib.syndication.feeds.Feed. That class has a feed_generator > attribute which will be where your MediaRSS class goes. Err ... feed_

Re: widget attribute help needed

2008-11-14 Thread Malcolm Tredinnick
On Fri, 2008-11-14 at 06:25 -0800, Bobby Roberts wrote: > hi. I have the following code in my forms.py > > > Anonymous = forms.ChoiceField (choices=Anonymous_Choices, > widget=forms.RadioSelect(attrs={'class':'anonymous'})) > > > which sets up a radio button UL on my form. This part is work

Re: Exclude fields in form by language

2008-11-14 Thread Malcolm Tredinnick
On Fri, 2008-11-14 at 10:44 -0800, Brandon Taylor wrote: > Hi Malcom, > > So, I manged to pass in the language_code parameter successfully: > > class CreditApplicationForm(forms.Form): > > def __init__(self, language_code, *args, **kwargs): > self.language_code = language_code >

Re: Views triggering twice

2008-11-14 Thread Malcolm Tredinnick
On Fri, 2008-11-14 at 13:58 -0500, Jeff Gentry wrote: [...] > I'm attaching a tarball, which immitates my setup in a minimal > fashion. At least when running on my system, the following browser > request triggers this behavior: > > http://servername/test/ > > > rendering at all. You could try

Re: Custom joins on multiple columns with Q objects

2008-11-14 Thread Malcolm Tredinnick
On Fri, 2008-11-14 at 08:10 -0800, David Elias wrote: > I'm using with Django 0.96 a custom Q object to make joins between > models, here's an example: > > class Product(models.Model): > group = models.IntegerField() # primary key > code = models.CharField() # primary key > name = mo

Re: question about queryset count function

2008-11-14 Thread Malcolm Tredinnick
On Fri, 2008-11-14 at 20:26 -0800, kaos wrote: [...] > Will that return the count of all of the articles in the given > category using a COUNT(*) query, or will it actually pull ALL of the > articles from the database and get the size of the array? > > Basically i'm trying to figure out if im be

Re: {%block%} inside {%if%} ?

2008-11-14 Thread Malcolm Tredinnick
On Fri, 2008-11-14 at 20:45 -0800, akonsu wrote: > hello, > > i noticed that if i put {%block%} tag inside {%if%} tag in my > template, the contents of the block gets rendered even when the {%if%} > test fails. is this a bug? It sounds like a bug in the way you've written your template. Because

Re: {%block%} inside {%if%} ?

2008-11-14 Thread Malcolm Tredinnick
On Fri, 2008-11-14 at 21:11 -0800, akonsu wrote: > Malcolm, thanks for the response. > > here is the relevant part of my template in a simplified form: > > {% if my_list %} > {% block head-extra %} > {{ block.super }} >

Re: Beginner desperately seeking Django experts.

2008-11-15 Thread Malcolm Tredinnick
On Fri, 2008-11-14 at 22:54 -0800, Innergy wrote: > Thanks for reading my question. I may not be asking all the right > questions. > > I am looking for a fast way to build a ecommerce site with many of the > qualities of threadless.com. I was told Django is an excellent > language and allows f

Re: checkbox and BooleanField

2008-11-15 Thread Malcolm Tredinnick
On Sat, 2008-11-15 at 15:28 +0100, Alfredo Alessandrini wrote: > Hi, > > I've this template: > > type="radio" checked /> > /> > type="radio" /> > > > And this View: > > class MoveGameForm(forms.Form): > resign = forms.BooleanField(required=False) >

Re: ManyToManyField with multiple model options

2008-11-15 Thread Malcolm Tredinnick
On Sat, 2008-11-15 at 06:57 -0800, Luke Seelenbinder wrote: > Basically, I want to allow a ManyToManyField to use any of a Model's > children, like this: > > class Word(models.Model): > word = models.CharField(...) > > class Meta: > abstract = True > > class Noun(Word): >

Re: ANN: Django 1.0.1 released

2008-11-15 Thread Malcolm Tredinnick
On Sat, 2008-11-15 at 13:31 -0500, BraneSKS wrote: > I am getting the same thing for the md5 sum. Downloaded through > Firefox 3.0.4 and Safari 3.1.2 on Mac OS X.5.5. Yep, looks like something went wrong there. James is offline at the moment, but he'll fix it when he gets a chance. The securit

Re: Forms Datefield ?

2008-11-15 Thread Malcolm Tredinnick
On Sat, 2008-11-15 at 22:37 +0100, [EMAIL PROTECTED] wrote: > hi, how do I change a datefield to d.m.Y in a form inherited from modelform ? You can't change that automatically. You will need to create a subclass of the model field that overrides the formfield() method to return a forms.DateFiel

Re: Templates and method arguments for thumbnails

2008-11-15 Thread Malcolm Tredinnick
On Sat, 2008-11-15 at 12:16 -0800, [EMAIL PROTECTED] wrote: > Hi, > > From the django documentation, it looks like it is not possible to > pass arguments to methods from the template HTML code. > > For example: > > class MyModel(Model): > def foo(self): > return 'This works' > > can be

Re: Query spanning two foreign keys

2008-11-15 Thread Malcolm Tredinnick
On Sat, 2008-11-15 at 17:09 -0800, Will McCutchen wrote: > Hi all, > > I've got the following models (simplified for this example): > > from django.db import models > from django.contrib.auth.models import User > > class Chat(models.Model): > name = models.CharField(max_length=256) > > cl

Re: ManyToManyField with multiple model options

2008-11-15 Thread Malcolm Tredinnick
On Sat, 2008-11-15 at 19:01 -0800, Luke Seelenbinder wrote: > That was a typo. The error I'm getting is > "ForeignKey cannot define a relation with abstract class Word" > It is a ManyToMany through table, that's the reason it is ForeignKey One of the many problems with top-posting is that I can'

Re: Models Not Showing In Admin

2008-11-15 Thread Malcolm Tredinnick
On Sat, 2008-11-15 at 19:28 -0800, Chris wrote: > I'm trying to get my models to show in admin. I've followed > http://www.djangobook.com/en/1.0/chapter06/ and while I'm able to > login to admin and view the Auth and Sites sections, I can't see my > models even though they have the Admin class an

Re: mod_python setup on Apache virtual host

2008-11-15 Thread Malcolm Tredinnick
On Sat, 2008-11-15 at 19:16 -0800, Chuck22 wrote: > I did not use ErrorDocument directives in my httpd.config. > > Here is my Apache error log: > > [Sun Nov 16 03:00:12 2008] [error] [client ] mod_python (pid=3296, > interpreter='domain.com', phase='PythonHandler', > handler='django.core.handle

Re: Models Not Showing In Admin

2008-11-15 Thread Malcolm Tredinnick
On Sat, 2008-11-15 at 21:06 -0800, Chris wrote: > Heh, thanks. That answers my question exactly. > > Are there any plans on removing the obsolete docs, or at least > forwarding users to the new docs? Django's documentation (http://docs.djangoproject.com/ -- also redirect to from django.project

Re: Multithreaded Dev Server

2008-11-15 Thread Malcolm Tredinnick
On Sat, 2008-11-15 at 21:17 -0800, Chris wrote: > Do you mean easier in that runserver doesn't support multithreading at > all? Or easier in that it supports multi-threading, but it's difficult > to set up? The dev server is single-threaded by design. It wouldn't be impossible to make it multi-t

Re: Multithreaded Dev Server

2008-11-15 Thread Malcolm Tredinnick
On Sat, 2008-11-15 at 21:40 -0800, Chris wrote: [...] > What's up with http://code.djangoproject.com/ticket/3357 ? Looks like > this idea isn't new. Actually, it shows that there are people who can't read instructions. Once a ticket has been wontifxed by a developer, it shouldn't be reopened wit

Re: mod_python setup on Apache virtual host

2008-11-15 Thread Malcolm Tredinnick
On Sat, 2008-11-15 at 21:36 -0800, Chuck22 wrote: > Because my application works fine with Django development server > (http://locahost:8000) on the same machine, I assume the problem does > not reside in my application code. Then it must be due to the > configuration of Apache. Presumably that'

Re: Post/redirect/get pattern for file upload with confirmation

2008-11-16 Thread Malcolm Tredinnick
On Sun, 2008-11-16 at 12:58 +0100, Stefan Wallner wrote: p,,,[ > My basic idea would be to use the same URL and view/template for > getting the directory listing and posting a file for uploading to it. > If a file is uploaded successfully the renamed file name and the users > that received

Re: Post/redirect/get pattern for file upload with confirmation

2008-11-16 Thread Malcolm Tredinnick
On Sun, 2008-11-16 at 04:39 -0800, [EMAIL PROTECTED] wrote: > Hi Malcolm, > thanks for the fast response. I had thought about both approaches, but > both didn't feel 100% right (more a gut feeling than anything). Then you're going to have provide more information about what would "feel right", s

Re: djangobook ch3, can't see the view current_datetime

2008-11-16 Thread Malcolm Tredinnick
On Sun, 2008-11-16 at 17:41 -0800, Adam Yee wrote: [...] Good debugging info snipped. > When entering http://localhost:8080/testproject/time I'm reading this > in the Apache error log: > > [Sun Nov 16 17:27:37 2008] [info] mod_wsgi (pid=1768): Create > interpreter 'ADAMYEE.gateway.2wire.net:80

Re: Django - Python 3

2008-11-16 Thread Malcolm Tredinnick
On Sun, 2008-11-16 at 19:10 -0700, Leonel Nunez wrote: > Hello: > > As we know python 3 is comming in December: > > http://www.python.org/download/releases/3.0/ > > Will there be many changes for django with python 3 Well, Django doesn't run out of the box on the Python 3 alphas, nor does 2

Re: Items tree in Django

2008-11-17 Thread Malcolm Tredinnick
On Mon, 2008-11-17 at 11:46 +0100, Fabio Natali wrote: [...] > The point is, how can I create the root of my tree? Should I add some > "blank=True, null=True" properties to my Node model? So to have: > > class Node(models.Model): > name = models.CharField(max_length=50) > parent = models

Re: ManyToMany and save method

2008-11-17 Thread Malcolm Tredinnick
On Mon, 2008-11-17 at 12:49 +0100, Marco Minutoli wrote: > I have this model: > > class Ticket(models.Model): > ## ForeignKey > project = models.ForeignKey ( > 'Project', > null=True, > blank=True, > verbose_name="Project", > ) > submitter = models

Re: Items tree in Django

2008-11-18 Thread Malcolm Tredinnick
On Mon, 2008-11-17 at 22:30 +0100, Fabio Natali wrote: > Hi Malcom! And thank you very much for your kind reply. > > Malcolm Tredinnick wrote: > [...] > > 500 leaves is really nothing for the database. If you want to do > > anything with that size tree, you can easily

Re: Items tree in Django

2008-11-18 Thread Malcolm Tredinnick
On Mon, 2008-11-17 at 11:07 -0800, Gustavo Picón wrote: [...] > So the usual recommendation is: > > - if you're going to insert a lot more than you read, use adjacency > list > - if, as is the most common case, you're going to read your tree more > than you insert nodes, use nested sets or mat

Re: Order of Middleware

2008-11-18 Thread Malcolm Tredinnick
On Mon, 2008-11-17 at 11:53 -0800, Peter wrote: > When I run django admin and do startproject I get a settings file that > has: > > MIDDLEWARE_CLASSES = ( > 'django.middleware.common.CommonMiddleware', > 'django.contrib.sessions.middleware.SessionMiddleware', > 'django.contrib.auth.m

Re: caching queryset for filtering

2008-11-18 Thread Malcolm Tredinnick
On Tue, 2008-11-18 at 07:09 -0800, Nicola Murino wrote: > Hi all, > > I read a lot of documentation about caching queryset but seems nothing > is useful for my purpose: > > I have to load a treeview and so perform virtually infinite recursion, > I want to minimize database access, here is my si

Re: django table locking

2008-11-18 Thread Malcolm Tredinnick
On Tue, 2008-11-18 at 12:10 -0800, msoulier wrote: > Hello, > > I have a daemon process running using the Django ORM API to access/ > modify tables in PostgreSQL. I just ran into an issue where it looks > like the process is keeping read-locks on the tables that it is > reading, which is prevent

Re: Subtle Memory Leak Finally Found! (DEBUG is off)

2008-11-18 Thread Malcolm Tredinnick
On Tue, 2008-11-18 at 08:24 -0800, 7timesTom wrote: [...] > Maybe this post will help someone else also one thing I don't > understand: > > Why wasn't the memory returned to me after each page view? Why was an > apache off/on necessary to clear memory? And is there anything I can > do to help c

Re: MySQL deadlocking issues

2008-11-18 Thread Malcolm Tredinnick
On Wed, 2008-11-19 at 10:21 +0900, Ian Lewis wrote: > I've run into the following error in a SQL DB envornment and was > wondering if any one else had run into problems with Deadlocking with > MySQL. What would be the proper way to handle this kind of error in > Django? > > Do most folks simply

Re: get_profile issue

2008-11-18 Thread Malcolm Tredinnick
On Tue, 2008-11-18 at 18:27 -0800, Mikel Pierre wrote: > Hi to all. > > I'm developing my first django app and very happy so far. > > But I've a problem and I was unable to find the solution searching in > djangoproject.com and this group. > > I have this in a template: > > Users list > {% if

Re: Default custom settings

2008-11-18 Thread Malcolm Tredinnick
On Tue, 2008-11-18 at 18:51 -0800, mdnesvold wrote: [...] > I guess your patterns would get the job done, even if they don't play > nicely with manage.py diffsettings. "diffsettings" only compares your settings file against global settings. So application settings are only ever going to show up

Re: Subtle Memory Leak Finally Found! (DEBUG is off)

2008-11-18 Thread Malcolm Tredinnick
On Wed, 2008-11-19 at 11:53 +1100, Malcolm Tredinnick wrote: [...] > Once memory gets to the over-allocated stage, > it will be reclaimed... Thinking about it further, this is rubbish. Details (if you care): Memory allocated with malloc(), etc, won't necessarily be reclaimed, since

Re: Reverse mapping URLs: why?

2008-11-18 Thread Malcolm Tredinnick
On Tue, 2008-11-18 at 19:46 -0800, stevedegrace wrote: [...] > I'm hoping someone more experienced with Django will explain the > rationale for the preferred paradigm and show me where I have gone > astray above, because I'm at a critical juncture in my own project... > right now based on the abo

Re: Non-ASCII character - strange error

2008-11-19 Thread Malcolm Tredinnick
On Wed, 2008-11-19 at 21:24 +0900, Dominic Ashton wrote: > > Guys, > > > Just had the strangest thing happened. > > Finished working on my project last night and everything was working > fine. I backed up the directory using tar, log on today and start my > development server and get the fol

Re: caching queryset for filtering

2008-11-19 Thread Malcolm Tredinnick
On Wed, 2008-11-19 at 00:34 -0800, Nicola Murino wrote: [...] > I would like to do something similar to this: > > > def recursive(n,o1): > nodes=Nodes.objects.select_related().filter(sublivello_di=n) > o1=o1.filter(node=n) > . > > for o in o1: #no db access I passed the f

Re: dynamic choices iterator in model field

2008-11-19 Thread Malcolm Tredinnick
On Wed, 2008-11-19 at 09:42 -0800, Delta20 wrote: > A model field may have a 'choices' option to which you assign an > iterable object -- typically a list, but this can also be an iterable > function. Is there a way to assign a class method/function rather than > a module function? No. Python di

Re: Customising slugify filter

2008-11-19 Thread Malcolm Tredinnick
On Wed, 2008-11-19 at 12:44 -0800, Nick wrote: > Hi, > > I have the following strings which is run through the slugify filter > on my site: > > "Business/Executives" > > and it becomes "businessexecutives". I'd like this to instead become > "business-executives" (as they are actually two sepe

Re: Back references for inherited models in Django 1.0

2008-11-19 Thread Malcolm Tredinnick
On Wed, 2008-11-19 at 17:46 +, Martin Green wrote: > Thanks Rajesh, > > That should sort out my problem. > > As a side note, it seems 'base' and 'base__inherited' appear to do the > same thing: This is true because the SQL query is filtering on primary key values and both the Base instance

Re: Combine QuerySets from two different child models

2008-11-19 Thread Malcolm Tredinnick
On Wed, 2008-11-19 at 11:04 -0800, Luke Seelenbinder wrote: > the models are: > > class Word(models.Model): >... some stuff... > >class Meta: >abstract=True > class Noun(Word): > .. some stuff .. > class Verb(Word): > ... some stuff ... > > code: > > nouns= Noun.objects.

Re: Filtered choices list for a m2m field from an m2m field within another model.

2008-11-19 Thread Malcolm Tredinnick
On Wed, 2008-11-19 at 13:35 -0800, Silvano wrote: > Dear all > > I'm completely stuck with the following problem. > > What I'm trying to accomplish is: I have an app with the model > "Project" and another model "Contacts". In "Contacts" I have a m2m > field called "projects_involved" relating t

Re: referencing style sheets in templates

2008-11-19 Thread Malcolm Tredinnick
On Wed, 2008-11-19 at 15:46 -0800, ayayalar wrote: > Hello, > > I am running into an issue with style sheets are not being found (404) > > Example: > > My Directory structure: > > C:\DJANGO\MYSITE2\TEMPLATES > └───hello > │ index.html > │ > └───css > base.css >

Re: Reverse mapping URLs: why?

2008-11-19 Thread Malcolm Tredinnick
On Wed, 2008-11-19 at 18:06 -0800, stevedegrace wrote: > > > On Nov 19, 12:04 am, Malcolm Tredinnick <[EMAIL PROTECTED]> > wrote: > [...] > > (5) Using reverse() is often a lot more explicit than a writing the URL > > out in full. Which of these is more immedia

Re: Bug? Related manager not working for custom manager?

2008-11-19 Thread Malcolm Tredinnick
On Wed, 2008-11-19 at 18:21 -0800, John M wrote: > I have a model with a custom model manager used for related set > filtering, but it's not working as expected. > > See my models and test at http://dpaste.com/92327/ > > Can someone explain why my manager isn't doing what I think it should? Th

Re: caching queryset for filtering

2008-11-20 Thread Malcolm Tredinnick
On Thu, 2008-11-20 at 00:34 -0800, Nicola Murino wrote: [...] > I want populate a queryset for example with all table elements, for > example: > > nodes=Nodes.objects.select_related().all() > > I want this query is performed so for example i do > > print nodes > > next I want to do nodes.filt

Re: many to many matrix

2008-11-20 Thread Malcolm Tredinnick
On Thu, 2008-11-20 at 00:19 -0800, frans wrote: > Hi, I was wondering if there is some way to create a "matrix display" > for viewing/editing many to many relationships between objects ? > > I've been thinking to use django for network documentation. My idea is > to put all the networks we host

Re: Caching and I18n

2008-11-20 Thread Malcolm Tredinnick
On Thu, 2008-11-20 at 07:17 -0200, Ramiro Morales wrote: > On Sun, Nov 16, 2008 at 10:14 PM, [EMAIL PROTECTED] > <[EMAIL PROTECTED]> wrote: > > > > Hello Ramiro, > > > > thanks for your reply. According to the docs, the Locale and Session > > middlewares should set the Vary-On headers accordingly

Re: del session variables

2008-11-20 Thread Malcolm Tredinnick
On Thu, 2008-11-20 at 14:06 -0800, Bobby Roberts wrote: > is there a way to kill a session rather than running a del statement > on each session variable? I know in .asp you can simply say > session.abandon. Is there an equivalent with django? Django has this really nifty feature (I believe AS

Re: Is it possible to display multiple forms in a single template file?

2008-11-20 Thread Malcolm Tredinnick
On Thu, 2008-11-20 at 14:03 -0800, ayayalar wrote: [...] > URLS > urlpatterns = patterns('', > > (r'^product/$', views.add_product), > (r'^product/$', views.add_product_details), This has no chance of doing what you expect. Only one view function will be called for a single request. If

Re: indentation problem in file

2008-11-20 Thread Malcolm Tredinnick
On Thu, 2008-11-20 at 15:07 -0800, waltbrad wrote: [...] > Thanks for the response Steve. My code looks exactly as I posted it, > spaces and all. The error you posted also will have told you where the error was occurring, not just the error message. That would certainly be a good guide. It cert

Re: Is it possible to display multiple forms in a single template file?

2008-11-20 Thread Malcolm Tredinnick
On Thu, 2008-11-20 at 15:18 -0800, ayayalar wrote: > I understand, I wish it was possible to bind multiple view functions > to a single template through the urls... Why? It's the wrong level of coupling. Each URL patterns ends up resolving to a single view function. However that view function ca

Re: Validating two forms in one

2008-11-21 Thread Malcolm Tredinnick
On Fri, 2008-11-21 at 10:28 +0100, Florencio Cano wrote: > Hello all, > I have two models called User and Responsible. When I add a > Responsible automatically a User is added. I have only one form to add > a User and a Responsible. > > class NewUserResponsibleForm(forms.Form): > username =

Re: Flatpage App vs. Static Template

2008-11-21 Thread Malcolm Tredinnick
On Fri, 2008-11-21 at 03:29 -0800, Caisys wrote: > Hi, > I would like to publish some statics files on my website and I have a > some questions: > 1- The flatpage app examples like http://www.lawrence.com/about/staph/ > contain elaborate html, is this edited as a text field in the admin > interfa

  1   2   3   4   5   6   7   8   9   10   >