Error encountered in django

2006-11-19 Thread Adrien
Hi All! Im starting my way to the django arena but this error stopped me from continuing. I'm a newbie in python and thought that through hands on experience, I will be able to learn this language especially for the web. Here goes the error: Traceback (most recent call last): File "c:\django_sr

Re: What is __init__.py for?

2006-11-19 Thread Don Arbow
On Nov 19, 2006, at 11:29 AM, Jeremy Dunck wrote: > In the simplest case, __init__.py can just be an empty file, but it > can > also execute initialization code for the package or set the __all__ > variable, described later. it's also handy to store code where you don't want another namespace

/admin/ works with www, not without, on just one domain

2006-11-19 Thread Julio Nobrega
Hi! I have two domains running Django. In one, I can access: http://babaia.com.br/admin/ or http://www.babaia.com.br/admin/ But on the other one: http://miniurl.com.br/admin/ gives me an error and http://www.miniurl.com.br/admin/ works fine. Here are their VirtualHost. Each reside on

Re: Newbie Server setup question

2006-11-19 Thread tsnyder
So how far have you gotten? Do you have apache, python 2.4, django, and flup on your Mac? Are you having trouble installing things? Are you just having trouble with fcgi? Do you have an ip number or name for your Mac server? What is your current situation. I use an old Mac running 10.3 as my

Re: Django + FastCGI Problems

2006-11-19 Thread mikeb
I think I have a solution. It's not great but it will have to do while I stay with Dreamhost (or until Dreamhost has formal Django support). Apache answers the requests, passes them on to lighttpd running on a different port which then talks to fcgi. This gives me full control over the whole web

Re: convert string to valid filter arg?

2006-11-19 Thread hotani
Small correction: The completed example should be as follows (with parens around 'OR' lookup): -- Q(res__isnull='on') & (Q(desc__icontains='bla') | Q(title__icontains='bla')) -- --~--~-~--~~~---~--~~ You received this message because you are s

Re: convert string to valid filter arg?

2006-11-19 Thread hotani
Fixed! Just changed commas to '&' - the queries work the same, and eval doesn't try to turn the string into a tuple. Staring at the docs for a while works wonders... I changed this: - Q(res__isnull='on'), Q(desc__icontains='bla') | Q(title__icontains='bla') To this: -

Re: Combining apps?

2006-11-19 Thread ringemup
I don't know that it's "bad behaviour" to use it. In my experience, it's been unreliable, so if you're using it to do something important (i.e. other than logging), it's not a bad idea to check whether it's empty and have a default value as a backup. I'll definitely look up context processors -

Re: runserver and static files

2006-11-19 Thread Jean-Luc
As I explain before, my problem was the use of 'media' as directory for static files media/css/*.css media/images/*.png media/js/*.js when I replace media by site-media, all work with this URL #fichiers statiques (images, css, ...) urlpatterns += patterns('', (r'^site_media/(?P.*)$', 'djan

Re: Combining apps?

2006-11-19 Thread Guillermo Fernandez Castellanos
> The problem is that if I'm putting polls on every page of the blog, > then I have to change each URL in the urlconf to optionally include a > has_voted variable, right (since I'm returning people to their > originating page via a redirect, not via the POST request itself)? In this case, you can

Re: paginating django.views.generic.date_based.archive_index based archives

2006-11-19 Thread Jean-Luc
see http://www.rossp.org/blog/2006/jun/23/building-blog-django-4/ courage ! jlT --~--~-~--~~~---~--~~ 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.

Re: What is __init__.py for?

2006-11-19 Thread ringemup
Thanks, everyone! And yes, I did Google it, but I didn't realize it was a Python thing instead of a Django thing (yeah, I'm a Python n00b too), so I googled "django __init__.py" and just got a lot of bug tracker results. Sorry for the stupid question. --~--~-~--~~~-

Re: Combining apps?

2006-11-19 Thread ringemup
The problem is that if I'm putting polls on every page of the blog, then I have to change each URL in the urlconf to optionally include a has_voted variable, right (since I'm returning people to their originating page via a redirect, not via the POST request itself)? Unless I'm going to store it

Re: auto total field

2006-11-19 Thread Guillermo Fernandez Castellanos
Did you put the Stock model before the OrderItem model? Sometimes this makes problems. If you did, what about this as an alternate solution? class Stock(models.Model): price = models.FloatField(max_digits=10, decimal_places=2) class OrderItem(models.Model): quantity = models.SmallIntegerF

Re: What is __init__.py for?

2006-11-19 Thread João Cruz Morais
It tells python that the folder is a package, so that it can be used with import statements. Also, searching google doesn't hurt - http://www.python.org/doc/2.5/tut/node8.html#SECTION00840 João ringemup escreveu: > I've noticed all these __init__.py files are generated when you

Re: Combining apps?

2006-11-19 Thread Guillermo Fernandez Castellanos
Mmm... you are writting your current view. So just add a variable "has_voted" that will be true if the IP (or user) has voted. I don't know if you are using the poll version of the tutorial or mine. If you are using the version of the tutorial, you might be interested in this, where I added suppo

Re: Newbie Server setup question

2006-11-19 Thread Bucco
P.S. What is the file mysite.fcgi? I found this on the other set of directions for installing fastcgi. Thanks:) On Nov 19, 12:55 pm, "Bucco" <[EMAIL PROTECTED]> wrote: > I have an old mac running OS X 10.3 that I am trying to set-up as a > server. It is running Apache 1.3. I followed the ins

Re: What is __init__.py for?

2006-11-19 Thread Jeremy Dunck
On 11/19/06, ringemup <[EMAIL PROTECTED]> wrote: > > I've noticed all these __init__.py files are generated when you create > a new app in django, and I can't find any documentation on them. What > are they for? What does one do with them? " The __init__.py files are required to make Python tre

Re: What is __init__.py for?

2006-11-19 Thread Fredrik Lundh
ringemup wrote: > I've noticed all these __init__.py files are generated when you create > a new app in django, and I can't find any documentation on them. What > are they for? What does one do with them? it tells Python that the directory is a package directory. if you have mydir/foo/

Re: What is __init__.py for?

2006-11-19 Thread Waylan Limberg
On 11/19/06, ringemup <[EMAIL PROTECTED]> wrote: > > I've noticed all these __init__.py files are generated when you create > a new app in django, and I can't find any documentation on them. What > are they for? What does one do with them? > > thanks. > > This is a Python thing, not just a Djan

What is __init__.py for?

2006-11-19 Thread ringemup
I've noticed all these __init__.py files are generated when you create a new app in django, and I can't find any documentation on them. What are they for? What does one do with them? thanks. --~--~-~--~~~---~--~~ You received this message because you are subsc

Newbie Server setup question

2006-11-19 Thread Bucco
I have an old mac running OS X 10.3 that I am trying to set-up as a server. It is running Apache 1.3. I followed the instructions for setting up fastcgi from: http://code.djangoproject.com/wiki/OsxFcgi I am trying to use do all of the worj through a ssh terminal on a windows XP box and want to

Re: Error:'Model' object has no attribute '_meta'

2006-11-19 Thread halmcelroy
Ooops :) Thanks --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTEC

Re: runserver and static files

2006-11-19 Thread Igor Guerrero Fonseca
I finally found it, put this in your urls(this works to me!): (r'(^|/)css/(?P.*)$', 'django.views.static.serve', {'document_root': 'templates/css/', 'show_indexes': True}), Maybe you already do that... but just for another that have the same problem :-P -- http

Re: Using a ManyToManyField's intermediate table?

2006-11-19 Thread [EMAIL PROTECTED]
Hi, berto, It looks like PreferenceOption contains the potential values for a given preference. If that is right, it seems like you want to add a class to your model to tie the User, Preference, and PreferenceOption values together: class UserPreferenceValue(models.Model): user = models.Forei

Re: Duplication of inline objets y custom template

2006-11-19 Thread ElGranAzul
Oh, a lot of thanks. It works fine now. :) --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, se

Re: Error:'Model' object has no attribute '_meta'

2006-11-19 Thread Jacob Kaplan-Moss
On 11/19/06 4:22 AM, halmcelroy wrote: > This is a pretty basic model: > > from django.db import models > class A(models.Model()): ^ Should be:: class A(models.Model): ^^^ ``models.Model()`` -- with the parens -- instantiates the (abs

Re: Duplication of inline objets y custom template

2006-11-19 Thread Ivan Sagalaev
ElGranAzul wrote: > Hi all. > > I'm creating a custom template and I'm following the instructions in > http://www.pointy-stick.com/blog/2006/07/03/django-tips-forms-multiple-inline-objects/. > Al works good, but when i modify the main model, the children are > duplicated. You're probably don't i

Error:'Model' object has no attribute '_meta'

2006-11-19 Thread halmcelroy
This is a pretty basic model: from django.db import models class A(models.Model()): a = models.CharField(maxlength=1000) b = models.CharField(maxlength=1000) def __str__(self): return self.a class User(models.Model()): username = models.CharField(maxlength=50) def __s

Duplication of inline objets y custom template

2006-11-19 Thread ElGranAzul
Hi all. I'm creating a custom template and I'm following the instructions in http://www.pointy-stick.com/blog/2006/07/03/django-tips-forms-multiple-inline-objects/. Al works good, but when i modify the main model, the children are duplicated. I've search a lot, but I've not found any solutions o

Limiting templatetags object. char output

2006-11-19 Thread Matth
Is there a simple way to limit the char output of {{ object.quote }} to 200 chars, a preview only. Can this be done in the template itself or should it be done by spitting the contents of quote into 2 fields during admin post processing? here is the code # templatetag # from django import templat

a question about django's branch "multiple-db-support"

2006-11-19 Thread [EMAIL PROTECTED]
I have install multiple-db-support branch, and write some code like that: #settings.py DATABASE_ENGINE = 'mysql' # 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'. DATABASE_NAME = 'django' # Or path to database file if using sqlite3. DATABASE_USER = 'root' # Not

Div 'Changelist-filter' overlaps the displaying of some columns in change-list template.

2006-11-19 Thread Vizcayno
Hello: I am using "list_filter" option in models.py for 3 fields. The model where the filter is, has many columns so, when showing its data in the "change-list" admin template I frequently use the horizontal bar. The problem I have is that does not locate/show its filter content at the end of the

Limiting templatetags object variable char output

2006-11-19 Thread Matth
Is there a simple was to limit the output of {{ object.quote }} to 200 chars, in the template or should this be done by splitting quote into 2 fields during admin post processing? here is the code # templatetag # from django import template from company.testimonial.models import Testimonial regi

Using a ManyToManyField's intermediate table?

2006-11-19 Thread berto
Hi, I created a couple of models: PreferenceOption(models.Model): name = models.CharField(maxlength=32) [...] Preference(models.Model): name = models.CharField(maxlength=64) options = models.ManyToManyField(PreferenceOption, blank=True, null=True) [...] In the database this

object. char limit

2006-11-19 Thread Matth
Is there a simple way to limit the chars on object.variable output? here is the code... # templatetag # from django import template from aatg.testimonial.models import Testimonial register = template.Library() import random def random_testimonial(): return {'object': Testimonial.objects

Re: Database optmization guru needed...

2006-11-19 Thread Tom Smith
Essentially I think the problem is this... I am trying to do an ORDER BY on a pre-populated (and indexed) column called random_number... I created this column because RAND() is so slow... It is the ORDER BY which is causing all the slow downs... If I do a select without the order by it is

Re: Database optmization guru needed...

2006-11-19 Thread Tom Smith
Really what I need to do is "re-order" the database rows (for good) by the random_number column... note.. I am not using RAND() at all... Hey, this gives me an idea... Given I have price ranges 1-2, 2-5, 5-10 etc... and the prices are all like 1.99, 1.96 etc... What if I precalculate a value

Re: Database optmization guru needed...

2006-11-19 Thread Tom Smith
On 18 Nov 2006, at 19:35, Jeremy Dunck wrote: > This isn't a Django question, but indexes only work well when there's > a large distribution of values. If lots of your products are in that > price range, you're still ordering by loads of randoms. Try assigning > (as a column value) a random int

Re: Database optmization guru needed...

2006-11-19 Thread Tom Smith
On 18 Nov 2006, at 18:59, tonemcd wrote: > > Perhaps something from here will help? > > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/59883 > > Where your list is an xrange(min...max) of id's from your database > table. That is, do it in python, not with your database... Ah sorry, for

Re: Django + FastCGI Problems

2006-11-19 Thread Tom Smith
On 19 Nov 2006, at 05:35, coulix wrote: > mikeb i have the same problem it takes few minutes to come back and i > see a lot of python process waiting for whatever. > kill kill all ect have no effects. > But once it runs its all good. I have never found that the "touching" thing ever worked, but

Re: A Rails/Django Comparison

2006-11-19 Thread Alan Green
Ben and I would like to send out a big thanks to everyone who provided constructive feedback on our Rails/Django paper. It's all been incorporated, either into the paper or as part of our OSDC presentation. Speaking of OSDC, will anyone else here be going? Finally, we would have loved to have do

Re: Re: Urgent upgraded to fedora core 6 python doesnt work if you guys know any pointer pls help out

2006-11-19 Thread James Bennett
On 11/19/06, krypton <[EMAIL PROTECTED]> wrote: > how do i get a release of psycopg2 for postgres libs For best results, do one of two things: 1. If you're installing from a pre-built binary package of psycopg2 on Fedora, using the 'rpm' command with (IIRC, been a while since I worked with Red H