slow response when using manage runserver without Internet connection

2006-08-21 Thread DD
Hi, I am using the Django built-in web server. The server's reponse time is nomal when connecting to Internet, once it's offline, the speed is extremely slow. Does anyone have experience how to fix it? Thanks, --~--~-~--~~~---~--~~ You received this message beca

Re: Creating a "mostly static" site with Django -- dumb idea?

2006-08-21 Thread Ian Holsman
you might want to check out hugo's dbtemplate loader (which I updated to work with the current trunk) http://svn.zyons.python-hosting.com/trunk/zilbo/common/dbloader/ that way you can store the templates themselves in a database, which might make life a bit more easier. regards Ian On 22/0

Re: Admin section: Possible to integrate image manipulation?

2006-08-21 Thread Bryan Chow
Hi Sean, Well, the main advantage is that PhotoField has already been written :) If PhotoField doesn't provide you with what you need, you could easily modify it, or use it as an example of how to create a custom field. Also, _post_save() has been deprecated since M-R was merged [1]. Regarding

Re: Creating a "mostly static" site with Django -- dumb idea?

2006-08-21 Thread Bryan Chow
Hi Sean, No worries, glad to hear that you find TemplatePages useful :) To answer your question, you can write a custom inclusion tag to insert snippets of dynamic content into your templates. http://www.djangoproject.com/documentation/templates_python/#inclusion-tags Alternately, you could use

Re: Admin section: Possible to integrate image manipulation?

2006-08-21 Thread Sean Schertell
Looks very interesting Bryan. But I wonder if you could tell me what advantages this would offer over just using the Python Image Library. Same question regarding Joe's suggestion of using pymagick. btw: Thanks Joe for answering my original question, a post-save hook sounds like just what I

django cannot connect to mysql after upgrade

2006-08-21 Thread zhongke chen
After upgrade mysql from 5.0.22 to 5.0.24, django cannot work with mysql. The error messages as following: Traceback (most recent call last): File "./manage.py", line 11, in ? execute_manager(settings) File "/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/management.py"

Re: Creating a "mostly static" site with Django -- dumb idea?

2006-08-21 Thread Sean Schertell
Hi Brian, I also owe you a big thanks :-) I hope Adrian and friends will consider rolling this or something like it into the django core. We really need a nice clean way to serve up static files within the context of a django website. If you consider that people me tend to build out the sta

Can't get Django to work Apache + mod_python

2006-08-21 Thread Silas
I'm having problems getting Django to work with Apache. Evenything works with "./manage.py runserver", but I get the errors listed below when I try to load the project with Apache and mod_python. I consistently get the same error the first and second refresh, followed by the "Third+" the rest of

Re: Distribute Django program to run on a local computer

2006-08-21 Thread Alan Green
On 8/22/06, Rob Hudson <[EMAIL PROTECTED]> wrote: > > I started the process of testing this on Windows and found that Python > is only about 12MB installed. Compared to about 120MB for Ruby. My > thinking now is that all we need is a local copy of Python, a wrapper > script to get Django up and

Re: Reproduce admin search functionality

2006-08-21 Thread Seth Buntin
So how will I get the queries if more than one word is used to search? The only reason I am using the way I am is in case people search multiple words. Can I run queries and add them together or something? --~--~-~--~~~---~--~~ You received this message because y

Re: Editting both sides of self-referential m2m relationship

2006-08-21 Thread Russell Keith-Magee
On 8/21/06, James Punteney <[EMAIL PROTECTED]> wrote: Thanks for the responses, and yeah Maciej is correct the m2mrelationship works fine without any errors, it's just that I can onlyedit the prey relationship (as Maciej text art does a much better jobof showing than my explanation). Ok. Now we're

Re: Distribute Django program to run on a local computer

2006-08-21 Thread Rob Hudson
I started the process of testing this on Windows and found that Python is only about 12MB installed. Compared to about 120MB for Ruby. My thinking now is that all we need is a local copy of Python, a wrapper script to get Django up and running and to launch a browser at localhost:8000, and we're

Re: Outer joins as extras()

2006-08-21 Thread Russell Keith-Magee
On 8/22/06, Alan Green <[EMAIL PROTECTED]> wrote: Hi,Has anybody found a way to add an table to query with an outer join? Anybody got a different way to do it?It isn't really a documented feature, and I haven't worked through the details (so you will need to do a little code spelunking by yourself)

Re: Reproduce admin search functionality

2006-08-21 Thread [EMAIL PROTECTED]
Seth Buntin wrote: > I got it!: > > def search(request): > keywords = request.GET['keyword'].split() > sql = "" > first = True > for word in keywords: > if first: > sql += "(title LIKE '%%" + word + "%%' OR description > LIKE '%%" + > wo

Re: Creating a "mostly static" site with Django -- dumb idea?

2006-08-21 Thread Bryan Chow
Cool! Glad to have helped. Cheers, Bryan On 8/21/06, Derek Hoy <[EMAIL PROTECTED]> wrote: > Just put this up on a site I'm moving from static pages to Django, and > it's just what I needed- I'd been doing something horrible with > subdomains to get it working, and been thinking of doing somethi

Re: Admin section: Possible to integrate image manipulation?

2006-08-21 Thread Bryan Chow
On 8/21/06, Sean Schertell <[EMAIL PROTECTED]> wrote: > ... I need my client to be able to upload some images in > the admin section, then have Python do some resizing > and cropping behind the scenes ... Take a look at PhotoField. Sounds like it would provide exactly what you're looking for. ht

Re: Admin section: Possible to integrate image manipulation?

2006-08-21 Thread Joe
You could write a post-save hook that manipulates the file after they are saved. Consider using the following python tool: http://www.python.net/crew/zack/pymagick/ This requires you to have image magik on your server. --~--~-~--~~~---~--~~ You received this me

Admin section: Possible to integrate image manipulation?

2006-08-21 Thread Sean Schertell
I'm trying to decide whether to build my own admin section or use the free one. The thing is, I need my client to be able to upload some images in the admin section, then have Python do some resizing and cropping behind the scenes. Do I need to make my own admin section for this? Or is th

Re: how to assign permissions to users and groups?

2006-08-21 Thread Luis P. Mendes
Chris Long escreveu: > If I have a group instance called students and I wanted to add it to > the user instance bill I would use: > bill.groups.add(students) > > If you want to have a permission for a view, you will have to use the > has_perm method that is within the user model (user.has_perm)

Re: [Fwd: multiple forms]

2006-08-21 Thread Alan Green
On 8/21/06, Sean <[EMAIL PROTECTED]> wrote: > > Hi, > I'm trying to write a batch insert view that gets data from a > > object-template, does some modification to the template (increment some > counters) and displays a form for each new object to be created. (I'm > adding Media files which are sel

Re: limit_choices_to Users in a Group

2006-08-21 Thread Corey Oordt
I think you need to include django.core.exceptions And I think that the exception is ObjectDoesNotExist Corey On Aug 21, 2006, at 4:24 PM, Waylan Limberg wrote: > > I figured this out, thanks to a suggestion in another thread. It seems > I was misunderstanding something about how limit_choice

Outer joins as extras()

2006-08-21 Thread Alan Green
Hi, Has anybody found a way to add an table to query with an outer join? I tried the Obvious Thing: queryset = Reader.objects.all().extras( select = {'other_name': 't.name'}, tables = ["left outer join other_table t on t.id = hr_reader.other_id"])) That results in the database complaini

Re: NULL for TextField

2006-08-21 Thread Corey Oordt
Why don't you: {% if form.myText.text %} My text: {{form.myText }} {% else %} No text yet. {% endif %} That will get a myText field passed in the post/get parameter. Corey On Aug 21, 2006, at 5:39 PM, cyberco wrote: > > Given the model: > === >

Re: Foreign key spaghetti

2006-08-21 Thread Sybren Stüvel
On Mon, Aug 21, 2006 at 01:18:03PM -0400, Waylan Limberg wrote: > If a Customer can NOT have a LifeInsurance without a Mortgage, then > just link LifeInsurance to Mortgage which will then link to a > Customer. Of course, if having a Mortgage is not a requirement for > LifeInsurance, that won't wor

Re: label and order of sub components in multiple table admin

2006-08-21 Thread hoangelos
Well the __str__ function doesn't help here. What I am talking about is I have is like this. Notice the __str__ def in BuyerAlcoholUse model. I would do OneToOne, because that is what it is, but I wanted it all on one page. These are all stored in seperate tables each model. I don't know if

When using the production environment I don't get anything returned

2006-08-21 Thread Chris Cooke
I have been trying to get Django working and have been playing around with it using the development server. I have followed the tutorial up to the admin stage (I have gone for the smallest test to eliminate variables) and I can see it working on the using the development server so I know that is

NULL for TextField

2006-08-21 Thread cyberco
Given the model: === myText = models.TextField(blank=True) === In case this TextField has no text I want to hide it from my form. Template code: === {% if form.myText.text %}

Re: Reproduce admin search functionality

2006-08-21 Thread Seth Buntin
I got it!: def search(request): keywords = request.GET['keyword'].split() sql = "" first = True for word in keywords: if first: sql += "(title LIKE '%%" + word + "%%' OR description LIKE '%%" + word + "%%')"

Reproduce admin search functionality

2006-08-21 Thread Seth Buntin
I am trying to reproduce the admin search functionality tell me what you think and how I can 1) fix it because it isn't working 2) improve it. Here is my view: keywords = request.GET['keyword'].split() sql = "" first = True for word in keywords: if first: sql += "(title LIKE '%" + wor

Re: limit_choices_to Users in a Group

2006-08-21 Thread Waylan Limberg
I figured this out, thanks to a suggestion in another thread. It seems I was misunderstanding something about how limit_choices_to works. Anyway, the following works: from django.contrib.auth.models import User, Group class Project(models.Model): coordinator = models.ForeignKey( User

Re: label and order of sub components in multiple table admin

2006-08-21 Thread Waylan Limberg
On 8/21/06, hoangelos <[EMAIL PROTECTED]> wrote: > I would like to control the label of the subcomponents. BuyerClothes > says "buyer clothes #1". http://www.djangoproject.com/documentation/model_api/#str > I also would like to make sure that > BuyerOccupations is listed on the Buyer Admin befo

Re: Process forking issues

2006-08-21 Thread Corey Oordt
I wrote some code that might help you out: it in the thread:http://groups.google.com/group/django-users/browse_frm/thread/b36f4ca10a424161/c5131410e5d548b1Depending on how you spawn a process, it can either wait for each, or become a child process.Calling the daemonize method with the appropriate p

label and order of sub components in multiple table admin

2006-08-21 Thread hoangelos
I have a Buyer model that has seperate one to one tables based on different organizational units. Maybe things like this: BuyerClothes BuyerOccupations and many more I would like to control the label of the subcomponents. BuyerClothes says "buyer clothes #1". I also would like to make sure th

Re: Editting both sides of self-referential m2m relationship

2006-08-21 Thread Maciej Bliziński
On Mon, 2006-08-21 at 09:36 -0400, James Punteney wrote: > Right now if I add say a "rabbit" I'd have to go to edit every other > animal that is a predator of the rabbit to specify that the rabbit is > prey for those other animals vs just selecting the predators on the > rabbit edit page. Which is

Overriding .save and Image upload

2006-08-21 Thread bayerj
Hi django users, I am currently trying to make a model `Image` create a thumbnail on save(). I know that there is a third party ImageWithThumbField, but (a) I'd like to make and (b) I am curious how my problem would be solved. As mentioned in the topic, I override the save method of my model. On

Re: how to assign permissions to users and groups?

2006-08-21 Thread Chris Long
If I have a group instance called students and I wanted to add it to the user instance bill I would use: bill.groups.add(students) If you want to have a permission for a view, you will have to use the has_perm method that is within the user model (user.has_perm) and check for the permission you w

how to assign permissions to users and groups?

2006-08-21 Thread Luis P. Mendes
Hi, What I want to do is to let users access some views but not others. Users can fit in groups. I've not set up the admin interface for this package because I don't find it useful for my purpose, at least yet. Users can already register themselves for the site. But they will only be able to ac

Re: Foreign key spaghetti

2006-08-21 Thread Waylan Limberg
If a Customer can NOT have a LifeInsurance without a Mortgage, then just link LifeInsurance to Mortgage which will then link to a Customer. Of course, if having a Mortgage is not a requirement for LifeInsurance, that won't work and you'll have to use your current scheme with an additional ForiegnK

Re: Process forking issues

2006-08-21 Thread tomass
Well, limited success. I was able to get the code working through closing the django db connection just after I'd forked my processes, but it seems that what I thought I was doing wasn't really what I thought I was doing. Essentially I wanted to be able to run multiple tasks simultaneously. I tho

Re: Efficient ways to limit_choices_to

2006-08-21 Thread Chris Long
Hey Seemant, Sorry about not getting back to you sooner to work on this. Been finishing off last minute details with my SoC project. Here is what I've come up w/ that (w/ my limited testing) seems to work: preacher = models.ForeignKey ( Person, limit_choices_to = { '

Re: Creating a "mostly static" site with Django -- dumb idea?

2006-08-21 Thread Derek Hoy
On 8/15/06, Bryan Chow <[EMAIL PROTECTED]> wrote: > > Ian Clelland and I wrote a Django app that does just that (mapping > URLs to mostly-static templates). Our code also takes several other > issues into consideration, such as sanitizing the URL so that > arbitrary files on the filesystem won't b

Re: Global Variables

2006-08-21 Thread Don Arbow
On Aug 21, 2006, at 3:59 AM, Thomas wrote: > An example would be something like displaying the > First name and Last name of a user that is logged in accross all my > pages. If you need to display information about the logged in user in your template, see this page: http://www.djangoproject.c

Re: Global Variables

2006-08-21 Thread James Bennett
On 8/21/06, Thomas <[EMAIL PROTECTED]> wrote: > but I am sure there must be a simpler way of retrieving the same > information site wide and on each page where needed? Below is an > example extract from my views.py file...see what I mean? I seem to be > calling / using the "c = Context({" too man

Re: Global Variables

2006-08-21 Thread Waylan Limberg
On 8/21/06, Thomas <[EMAIL PROTECTED]> wrote: > I seem to be > calling / using the "c = Context({" too many times. Is this the best > way of doing things? An example would be something like displaying the > First name and Last name of a user that is logged in accross all my > pages. Take a look b

Foreign key spaghetti

2006-08-21 Thread Sybren Stüvel
Hi folks, I want to have the following, but I'm not sure on how to do that. This is the layout of the models: CustomerData - name - age - etc. Mortgage - Many-to-one key to CustomerData - start date - end date - sum - etc. LifeInsurance - Many-to-one key to CustomerData - st

Efficient ways to limit_choices_to

2006-08-21 Thread seemant
Hi All, I've been struggling with this issue for a few days now. In IRC, clong got me the closest I've been to a solution, but things are still erroring out. I have two inital models: class Person( models.Model ): name = models.CharField (maxlength = 100) user = models.ForeignKey (

Global Variables

2006-08-21 Thread Thomas
Hi all, I have been scouring the docs but with no joy, or perhaps just my own stupidity. I am fairly new to Django / Python as a whole. I am developing a site where I need to set or pass a global variable between pages. Currently I am simply requesting it each time in my views.py file...but I am

[slightly OT] A rose by another name

2006-08-21 Thread Kenneth Gonsalves
hi, it was suggested describing django as 'Snakes on Planes', i just thought of SOS - SnakesOnSpeed -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the G

Re: URLField limitations

2006-08-21 Thread James Bennett
On 8/21/06, Cole Tuininga <[EMAIL PROTECTED]> wrote: > 1) The URLField type is being restricted to 200 characters. Is there > a reason for this? Can it be overridden? Not really. URLField subclasses CharField (because that's how it goes into the database), which means that no matter what there'

Re: Re: URLField limitations

2006-08-21 Thread James Bennett
Cut off while I was writing... Anyway, what I was going to suggest was that if you need the ability to take in URLs of arbitrarily extreme lengths, you're probably better off using a TextField for the URL and using the 'validator_list' argument to pass in validators which will check that it's a U

URLField limitations

2006-08-21 Thread Cole Tuininga
Hi folks - I'll preface this by saying that I'm a complete newbie, writing my first Django app. Partially for the experience, and partially driven by small need, I'm implementing an inhouse version of tinyurl (http://www.tinyurl.com/). The model is pretty simple - it looks like: # Create your mo

Re: Editting both sides of self-referential m2m relationship

2006-08-21 Thread James Punteney
Thanks for the responses, and yeah Maciej is correct the m2m relationship works fine without any errors, it's just that I can only edit the prey relationship (as Maciej text art does a much better job of showing than my explanation). Right now if I add say a "rabbit" I'd have to go to edit every o

Re: extract keywords from model

2006-08-21 Thread [EMAIL PROTECTED]
thanks, that worked richard --~--~-~--~~~---~--~~ 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 [

Re: how to add content of the page's textarea in django ?

2006-08-21 Thread Emmet Connolly
You might find this useful: http://www.djangoproject.com/documentation/faq/#how-do-i-use-image-and-file-fieldsEmmet On 8/20/06, rock <[EMAIL PROTECTED]> wrote: how to upload a picture ,then add the url link of the picture to thepage's textarea content. Some bbs can do this . But how can I do liketh

Re: extract keywords from model

2006-08-21 Thread limodou
On 8/21/06, richard mendes <[EMAIL PROTECTED]> wrote: > > Thanks for all advices, > > I looked at the objects.values() from the api before and that's what i > want. The only problem there is that it will give you back a empty > list when there are no values in de DB. > > Offcourse there is a optio

Re: extract keywords from model

2006-08-21 Thread richard mendes
Thanks for all advices, I looked at the objects.values() from the api before and that's what i want. The only problem there is that it will give you back a empty list when there are no values in de DB. Offcourse there is a option to put some values in the DB to begin with but that's not really a

[Fwd: multiple forms]

2006-08-21 Thread Sean
Hi, I'm trying to write a batch insert view that gets data from a object-template, does some modification to the template (increment some counters) and displays a form for each new object to be created. (I'm adding Media files which are selected in a previous view, that why I iterate over files)

Re: extract keywords from model

2006-08-21 Thread limodou
On 8/21/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Hello django users, > > sorry for this probably simple question but i couldn't find the answer > in the api nor this forum. > > suppose i have a model with 2 keywords like > > class Test(models.Model): >result_id = models.Integer

Special Tag Parser - A How-To

2006-08-21 Thread [EMAIL PROTECTED]
The Tutorial: http://code.djangoproject.com/wiki/contentBBCode_parser It describes how to make a pluggable special tag parser that is simillar to BBCode but it can do dynamic things, react on passed atributs :) For example this: [rk:codder lang="python"] for foo in bar: print foo [/rk:codder]

Re: extract keywords from model

2006-08-21 Thread spacedman
[EMAIL PROTECTED] wrote: > suppose i have a model with 2 keywords like > > class Test(models.Model): >result_id = models.IntegerField(maxlength=10) > lab_id = models.IntegerField(maxlength=10) > > is there a method to extract all the keywords from this class. > So in this example i

Re: extract keywords from model

2006-08-21 Thread Kenneth Gonsalves
On 21-Aug-06, at 4:16 PM, [EMAIL PROTECTED] wrote: > sorry for this probably simple question but i couldn't find the answer > in the api nor this forum. > > suppose i have a model with 2 keywords like > > class Test(models.Model): >result_id = models.IntegerField(maxlength=10) > la

extract keywords from model

2006-08-21 Thread [EMAIL PROTECTED]
Hello django users, sorry for this probably simple question but i couldn't find the answer in the api nor this forum. suppose i have a model with 2 keywords like class Test(models.Model): result_id = models.IntegerField(maxlength=10) lab_id = models.IntegerField(maxlength=10) is

Re: i18n: Translating include names

2006-08-21 Thread [EMAIL PROTECTED]
Yes, that would work AND would keep me from having presentation details in the view implementation. Cool. Thanks for the link! I hadn't found that yet. Daniel --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Djang

Re: Editting both sides of self-referential m2m relationship

2006-08-21 Thread Maciej Bliziński
On Mon, 2006-08-21 at 08:12 +0800, Russell Keith-Magee wrote: > And it works as expected except I can only edit the "prey" > part of the > relationship. Ideally I'd like to be able to specify both > predator and > prey when adding or editing an animal. Is th

Re: Login not working: Site matching query does not exist.

2006-08-21 Thread cyberco
Thank you very much! That was indeed the issue. There was a site in the db, but apparently things were corrupt. Removing all sites and adding a new one via the admin interface solved the problem. Not sure if that is a bug or a feature :) Your query works as well (although 'domain' and 'name' shou

Re: i18n: Translating include names

2006-08-21 Thread limodou
On 8/21/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Um, yes. I realize that would work. I guess I was looking for a more > "automagical" solution (which would not force me to change the template > when I come up with a French or Kisuaheli version of trogger :-) ). > > I think I'll go with

Re: Login not working: Site matching query does not exist.

2006-08-21 Thread Ian Holsman
your missing the site record. go into your database and create a record with the site_id from your project file eg. insert into django_site(id,name,domain) values (N, 'example','example.com') where 'N' is your SITE_ID. On 21/08/2006, at 6:40 PM, cyberco wrote: > > I'm still having this pr

Re: i18n: Translating include names

2006-08-21 Thread [EMAIL PROTECTED]
Um, yes. I realize that would work. I guess I was looking for a more "automagical" solution (which would not force me to change the template when I come up with a French or Kisuaheli version of trogger :-) ). I think I'll go with passing the name of the file to include in the Context and then jus

Re: Login not working: Site matching query does not exist.

2006-08-21 Thread cyberco
I'm still having this problem (neglected it for a while, but now is the time I MUST solve it). Has anybody here a suggestion in which direction to search? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django user

Re: django db models in other app

2006-08-21 Thread richard mendes
Thanks for your help, it's working Richard --~--~-~--~~~---~--~~ 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